Skip to content

Commit

Permalink
feat: update test to use jsonpath and regex
Browse files Browse the repository at this point in the history
  • Loading branch information
AlasDiablo committed Jan 17, 2024
1 parent efb5516 commit 2c36040
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 22 deletions.
2 changes: 1 addition & 1 deletion services/ark-tools/examples.http
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Content-Type: application/json
"title": "Curabitur molestie posuere arcu, eget pharetra lacus lobortis in."
},
{
"title": " Nulla in ipsum eu dui rhoncus fringilla. Ut interdum mi metus"
"title": "Nulla in ipsum eu dui rhoncus fringilla. Ut interdum mi metus"

}
]
Expand Down
34 changes: 13 additions & 21 deletions services/ark-tools/tests.hurl
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,11 @@ content-type: application/json
]

HTTP 200
[{
"id": "12345",
"value": "ark:/67375/XXX-VR4C38XD-3"
},
{
"id": "6789",
"value": "ark:/67375/XXX-HNXB328M-4"
}]
[Asserts]
jsonpath "$[0].id" == "12345"
jsonpath "$[0].value" matches /ark:\/67375\/XXX-.{8}-./
jsonpath "$[1].id" == "6789"
jsonpath "$[1].value" matches /ark:\/67375\/XXX-.{8}-./

POST https://ark-tools.services.istex.fr/v1/67375/stamp?subpublisher=XXX&indent=true
content-type: application/json
Expand All @@ -25,20 +22,15 @@ content-type: application/json
"title": "Curabitur molestie posuere arcu, eget pharetra lacus lobortis in."
},
{
"title": " Nulla in ipsum eu dui rhoncus fringilla. Ut interdum mi metus"
"title": "Nulla in ipsum eu dui rhoncus fringilla. Ut interdum mi metus"
}
]

HTTP 200
[{
"title": "Integer eget dignissim neque, sit amet sagittis nisi. In ornare massa lacus.",
"value": "ark:/67375/XXX-454RCWQ7-Z"
},
{
"title": "Curabitur molestie posuere arcu, eget pharetra lacus lobortis in.",
"value": "ark:/67375/XXX-Q9FMW9GQ-X"
},
{
"title": " Nulla in ipsum eu dui rhoncus fringilla. Ut interdum mi metus",
"value": "ark:/67375/XXX-RJPSCQ8X-T"
}]
[Asserts]
jsonpath "$[0].title" == "Integer eget dignissim neque, sit amet sagittis nisi. In ornare massa lacus."
jsonpath "$[0].value" matches /ark:\/67375\/XXX-.{8}-./
jsonpath "$[1].title" == "Curabitur molestie posuere arcu, eget pharetra lacus lobortis in."
jsonpath "$[1].value" matches /ark:\/67375\/XXX-.{8}-./
jsonpath "$[2].title" == "Nulla in ipsum eu dui rhoncus fringilla. Ut interdum mi metus"
jsonpath "$[2].value" matches /ark:\/67375\/XXX-.{8}-./

0 comments on commit 2c36040

Please sign in to comment.