Skip to content

Commit

Permalink
test(js): update error returned by empty script
Browse files Browse the repository at this point in the history
  • Loading branch information
matteo-cristino authored and jaromil committed Jun 30, 2024
1 parent 25562ea commit 4917528
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions bindings/javascript/src/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,26 +46,34 @@ test("does broke gracefully", async (t) => {
test("does handle empty zencode", async (t) => {
try {
await zencode_exec(null);
t.fail("NULL zencode script does not fail");
} catch (e) {
t.true(e.logs.includes("NULL string as script argument"));
const lines = JSON.parse(e.logs);
t.true(lines.includes("[!] NULL string as script argument"), e.logs);
}
try {
await zencode_exec(``);
} catch (e) {
t.true(e.logs.includes("Empty string as script argument"));
t.fail("empty zencode script does not fail");
} catch(e) {
const lines = JSON.parse(e.logs);
t.true(lines.includes("[!] Empty string as script argument"), e.logs);
}
});

test("does handle empty lua", async (t) => {
try {
await zenroom_exec(null);
t.fail("NULL lua script does not fail");
} catch (e) {
t.true(e.logs.includes("NULL string as script argument"));
const lines = JSON.parse(e.logs);
t.true(lines.includes("[!] NULL string as script argument"), e.logs);
}
try {
await zenroom_exec(``);
t.fail("empty lua script does not fail");
} catch (e) {
t.true(e.logs.includes("Empty string as script argument"));
const lines = JSON.parse(e.logs);
t.true(lines.includes("[!] Empty string as script argument"), e.logs);
}
});

Expand Down

0 comments on commit 4917528

Please sign in to comment.