diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2021-05-24 18:53:42 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-24 18:53:42 -0400 |
commit | 900bceda47e4c736e70a66e66cfce719b4c6d203 (patch) | |
tree | 045267dcafa66fcfe95897fb78942663590e1939 /test | |
parent | 54e102f343b651ac41b2ce34d38a3a4638192d4a (diff) |
Fix json schema array properties (#1709)
* Fix proxy array properties being handled incorrectly
* Add tests to check array properties
Diffstat (limited to 'test')
-rw-r--r-- | test/test-json-schema.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/test/test-json-schema.js b/test/test-json-schema.js index c5ff830a..1c61f1b8 100644 --- a/test/test-json-schema.js +++ b/test/test-json-schema.js @@ -946,7 +946,12 @@ function testProxy1() { {error: false, value: ['default'], action: (value) => { value[0] = 'string'; }}, {error: true, value: ['default'], action: (value) => { value[0] = null; }}, {error: true, value: ['default'], action: (value) => { delete value[0]; }}, - {error: false, value: ['default'], action: (value) => { value[1] = 'string'; }} + {error: false, value: ['default'], action: (value) => { value[1] = 'string'; }}, + {error: false, value: ['default'], action: (value) => { + value[1] = 'string'; + if (value.length !== 2) { throw new Error(`Invalid length; expected=2; actual=${value.length}`); } + if (typeof value.push !== 'function') { throw new Error(`Invalid push; expected=function; actual=${typeof value.push}`); } + }} ] }, |