xquery version "3.0"; module namespace s="http://satni.org/apps/satni/tests"; import module namespace satni="http://satni.org/apps/satni/resource/representation/v1" at "../modules/SatniResource.xqm"; declare namespace test="http://exist-db.org/xquery/xqsuite"; (:~ : Documentation: : http://exist-db.org/exist/apps/doc/xqsuite.xml (outdated) : https://github.com/wolfgangmm/xqsuite (source code xqsuite/xqsuite.xql) : : Annotations below are collected from xqsuite.xql file: : %test:arg($variableName, $value) : %test:args($arg1, $arg2, ...) : : %test:user($userName) : : %test:assertEquals($value) : %test:assertEqualsPermutation($value) : %test:assertEmpty : %test:assertExists : %test:assertTrue : %test:assertFalse : %test:assertError($error) : %test:assertXPath($XPath) : : To run the tests, either: : 1) Open test/suite.xql with eXide and run 'Eval' : 2) Call test/suite.xql with curl for example (doesn't seem to work): : 'curl -X GET localhost:8080/exist/apps/satni/test/suite.xql' :) (: Test dictionary function :) declare %test:assertExists %test:assertTrue %test:assertXPath("count($result//id) = 8") %test:assertXPath("$result//http:header[@name = 'Access-Control-Allow-Origin'][@value = '*']") function s:dictionaries() { satni:PUBLIC.f-dictionaries() }; (: Test search function :) declare %test:arg("query", "dep") %test:arg("dictid", "all") %test:assertExists %test:args("asdf", "all") %test:assertXPath("count($result//term) = 0") function s:search($query, $dictid) { satni:PUBLIC.f-search($query, $dictid, 0, 800) }; (: Test article function :) declare %test:arg("art", 'giehka') %test:assertXPath("count($result//term) = 3") %test:assertXPath("count($result//dict[. = 'termwiki']) = 1") %test:args("adgang") %test:assertXPath("count($result//dict[. = 'termwiki']) = 3") function s:article($art as xs:string*) { satni:PUBLIC.f-article($art) };