From f00a7b7cc4a472b4b57d1cf4f9f9f9120cf7c8dd Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Sat, 1 Jun 2024 18:19:27 +0200 Subject: [PATCH] Add some tests --- test/api.hurl | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 test/api.hurl diff --git a/test/api.hurl b/test/api.hurl new file mode 100644 index 0000000..c90792c --- /dev/null +++ b/test/api.hurl @@ -0,0 +1,40 @@ +GET http://localhost:8080/ +HTTP 200 +[Asserts] +header "Content-Type" contains "text/html" + + +POST http://localhost:8080/v1/exec +content-type: application/json +``` +{ + "sandbox": "hare", + "command": "run", + "files": { + "": "use fmt;\nexport fn main() void = {\nfmt::println(\"hello world\")!;\n};\n" + } +} +``` +HTTP 200 +[Asserts] +jsonpath "$.ok" == true +jsonpath "$.stdout" == "hello world\n" +jsonpath "$.stderr" == "" + + +POST http://localhost:8080/v1/exec +content-type: application/json +``` +{ + "sandbox": "hare", + "command": "run", + "files": { + "": "use fmt;\nexport fn main()\n" + } +} +``` +HTTP 200 +[Asserts] +jsonpath "$.ok" == true +jsonpath "$.stdout" == "" +jsonpath "$.stderr" matches "syntax error"