-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ajoute un set de tests pour le script dots_db_init.xq
- Loading branch information
1 parent
eda9719
commit 23d845a
Showing
6 changed files
with
130 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<dbSwitch xmlns="https://github.com/chartes/dots/"> | ||
<metadata> | ||
<dct:created xmlns:dct="http://purl.org/dc/terms/">2024-03-12T11:53:37.836+01:00</dct:created> | ||
<dct:modified xmlns:dct="http://purl.org/dc/terms/">2024-03-12T11:53:37.836+01:00</dct:modified> | ||
<totalProjects>0</totalProjects> | ||
</metadata> | ||
<member/> | ||
</dbSwitch> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<metadataMap xmlns="https://github.com/chartes/dots/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dct="http://purl.org/dc/terms/"> | ||
<metadata> | ||
<dct:created>2024-03-12T11:53:37.836+01:00</dct:created> | ||
<dct:modified>2024-03-12T11:53:37.836+01:00</dct:modified> | ||
</metadata> | ||
<mapping><dc:title xpath="//titleStmt/title[@type = 'main' or position() = 1]" scope="document"/><dc:creator xpath="//titleStmt/author" scope="document"/><dct:publisher xpath="//publicationStmt/publisher" scope="document"/></mapping> | ||
</metadataMap> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
xquery version '3.0' ; | ||
|
||
module namespace deployTest = "https://github.com/chartes/dots/deploimentTests"; | ||
|
||
import module namespace G = "https://github.com/chartes/dots/globals" at "../globals.xqm"; | ||
import module namespace functx = 'http://www.functx.com'; | ||
|
||
declare default element namespace "https://github.com/chartes/dots/"; | ||
|
||
declare variable $deployTest:dbSwitchModel := doc(concat($G:webapp, "dots/tests/data_model/dots_db_switcher.xml")); | ||
|
||
declare variable $deployTest:mappingModel := doc(concat($G:webapp, "dots/tests/data_model/dots_default_metadata_mapping.xml")); | ||
|
||
declare function deployTest:testDbSwitch() { | ||
let $dots := db:get($G:dots)/dbSwitch | ||
let $totalProjects := $dots/metadata/totalProjects | ||
let $member := $dots/member | ||
return | ||
( | ||
deep-equal($totalProjects, $deployTest:dbSwitchModel/dbSwitch/metadata/totalProjects), | ||
deep-equal($member, $deployTest:dbSwitchModel/dbSwitch/member) | ||
) | ||
}; | ||
|
||
declare function deployTest:testMetadataMapping() { | ||
let $dots := db:get($G:dots) | ||
let $mapping := $dots/metadataMap/mapping | ||
let $mappingModel := $deployTest:mappingModel/metadataMap/mapping | ||
return | ||
( | ||
deep-equal($mapping, $mappingModel) | ||
) | ||
}; | ||
|
||
declare %unit:test function deployTest:check-boolean-response($returned) { | ||
let $expected := true() | ||
for $r in $returned | ||
return | ||
unit:assert-equals($r, $expected) | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters