Comparing version
@@ -30,4 +30,2 @@ 'use strict'; | ||
const formatObject = (r, startPath) => { | ||
if (r.ok) return; | ||
const fl = flatten(r, startPath); | ||
@@ -34,0 +32,0 @@ |
{ | ||
"name": "skemata", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "An object structure and type validation library", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
19
test.js
@@ -108,2 +108,21 @@ import test from 'ava'; | ||
test('warnings', t => { | ||
const schema = v.object({ | ||
a: v.bool, | ||
b: v.deprecated(v.string, 'moved to `c`'), | ||
files: v.objects({ keys: ['javascripts', 'stylesheets'] }, v.bool) | ||
}); | ||
const result = schema({ a: true, b: 'string', files: { javascript: true } }); | ||
const fmt = skemata.formatObject(result, 'config'); | ||
t.deepEqual(fmt, { | ||
errors: [], | ||
warnings: [ | ||
{ path: 'config.b', warning: 'deprecated: moved to `c`' }, | ||
{ path: 'config.files.javascript', warning: 'unrecognized key: javascript; expected either of javascripts, stylesheets; perhaps you meant javascripts' } | ||
] | ||
}); | ||
}); | ||
test('errors and warnings', t => { | ||
@@ -110,0 +129,0 @@ const schema = v.object({ |
15318
4.08%448
3.46%