Remove log, clone test value before use (#1695)

This commit is contained in:
toasted-nutbread 2021-05-22 15:19:52 -04:00 committed by GitHub
parent c95827ae68
commit cb0e8ef235
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -40,6 +40,10 @@ function createProxy(schema, value) {
return new JsonSchemaValidator().createProxy(value, schema);
}
function clone(value) {
return JSON.parse(JSON.stringify(value));
}
function testValidate1() {
const schema = {
@ -799,8 +803,8 @@ function testProxy1() {
for (const {schema, tests} of data) {
for (let {error, value, action} of tests) {
if (typeof value === 'undefined') { value = getValidValueOrDefault(schema, void 0); }
value = clone(value);
assert.ok(schemaValidate(schema, value));
console.log(error, value, schema);
const valueProxy = createProxy(schema, value);
if (error) {
assert.throws(() => action(valueProxy));