diff --git a/package-lock.json b/package-lock.json index 95538d2..d4524a9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "zzapi", - "version": "1.0.2", + "version": "1.1.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "zzapi", - "version": "1.0.2", + "version": "1.1.1", "license": "MIT", "dependencies": { "got": "11.8.6", diff --git a/src/runTests.ts b/src/runTests.ts index 4faae0b..f1692ac 100644 --- a/src/runTests.ts +++ b/src/runTests.ts @@ -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;