diff --git a/.github/workflows/dots-CI.yml b/.github/workflows/dots-CI.yml index 9c54c02..03eea68 100644 --- a/.github/workflows/dots-CI.yml +++ b/.github/workflows/dots-CI.yml @@ -22,13 +22,10 @@ jobs: cd basex chmod +x bin/basex - - name: Run DoTS XQuery Tests - run: | - ./basex/bin/basex ./tests/launcher.xq - - - name: Start BaseX Server + - name: Start BaseX Server and Run Init Tests on Endpoints run: | ./basex/bin/basexhttp + ./basex/bin/basex ./tests/launcher.xq ./basex/bin/basexhttpstop diff --git a/tests/initTestsEndpoint.xqm b/tests/initTestsEndpoint.xqm new file mode 100644 index 0000000..a07aea8 --- /dev/null +++ b/tests/initTestsEndpoint.xqm @@ -0,0 +1,21 @@ +xquery version '3.0' ; + +module namespace initTests = "https://github.com/chartes/dots/initTests"; + +declare function initTests:endpoint($url) { + let $statutCode := http:send-request(, $url) + return + normalize-space($statutCode/@status) +}; + +declare %unit:test function initTests:check-value-response200($url) { + let $expected := "200" + return + unit:assert-equals(initTests:endpoint($url), $expected) +}; + +declare %unit:test function initTests:check-value-response400($url) { + let $expected := "400" + return + unit:assert-equals(initTests:endpoint($url), $expected) +}; \ No newline at end of file diff --git a/tests/launcher.xq b/tests/launcher.xq index 5a2e109..557cdee 100644 --- a/tests/launcher.xq +++ b/tests/launcher.xq @@ -1,8 +1,12 @@ xquery version '3.0' ; import module namespace test = "https://github.com/chartes/dots/tests" at "utilsTest.xqm"; +import module namespace initTests = "https://github.com/chartes/dots/initTests" at "initTestsEndpoint.xqm"; (: :) -test:check-metadata-output() +initTests:check-value-response200("http://localhost:8080/api/dts"), +initTests:check-value-response200("http://localhost:8080/api/dts/collection"), +initTests:check-value-response400("http://localhost:8080/api/dts/navigation"), +initTests:check-value-response400("http://localhost:8080/api/dts/document")