aboutsummaryrefslogtreecommitdiffstats
path: root/test/Spec.hs
blob: c85ac5329ce9f5d1e32dd23275f13ea4731e7b49 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import Data.JLD.Prelude

import Test.Tasty

import Data.JLD.Mime (mimeType)
import Test.Common (W3CTestList)
import Test.Expansion (expansionTests)
import Test.Flattening (flatteningTests)

import Network.HTTP.Req (GET (..), NoReqBody (..), defaultHttpConfig, header, https, jsonResponse, req, responseBody, runReq, (/:))

tests :: W3CTestList -> W3CTestList -> TestTree
tests expansionTestList flatteningTestList =
    testGroup
        "Tests"
        [ expansionTests expansionTestList
        , flatteningTests flatteningTestList
        ]

main :: IO ()
main = do
    expansionTestList <- runReq defaultHttpConfig do
        responseBody <$> req GET w3cExpansionTestListUrl NoReqBody jsonResponse (header "Accept" mimeType)

    flatteningTestList <- runReq defaultHttpConfig do
        responseBody <$> req GET w3cFlatteningTestListUrl NoReqBody jsonResponse (header "Accept" mimeType)

    defaultMain <| tests expansionTestList flatteningTestList
  where
    w3cExpansionTestListUrl = https "w3c.github.io" /: "json-ld-api" /: "tests" /: "expand-manifest.jsonld"
    w3cFlatteningTestListUrl = https "w3c.github.io" /: "json-ld-api" /: "tests" /: "flatten-manifest.jsonld"