Skip to content

Commit

Permalink
Merge pull request #4 from agrostar/vscode_issue-4_size-gt-lt
Browse files Browse the repository at this point in the history
addressing issue 4 in zzapi-vscode
  • Loading branch information
vasan-agrostar authored May 12, 2024
2 parents 628e191 + 0163b5b commit fdf01b8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 12 additions & 1 deletion src/runTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,18 @@ function runObjectTests(
} else if (typeof receivedObject === "string" || Array.isArray(receivedObject)) {
receivedLen = receivedObject.length;
}
pass = receivedLen === expected;
if (typeof expected === "number") {
pass = receivedLen === expected;
} else {
try {
expected = JSON.parse(expected);
results.push(...runObjectTests(expected, receivedLen, spec));
continue;
} catch (err: any) {
pass = false;
message = `$size val is not num or valid JSON`;
}
}
} else if (op === "$exists") {
const exists = received != undefined;
pass = exists === expected;
Expand Down

0 comments on commit fdf01b8

Please sign in to comment.