Skip to content

Commit 96a440b

Browse files
committed
add required test for allOf
1 parent 3998190 commit 96a440b

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

test/allof.test.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const test = require('tap').test
44
const build = require('..')
55

66
test('object with allOf and multiple schema on the allOf', (t) => {
7-
t.plan(2)
7+
t.plan(4)
88

99
const schema = {
1010
title: 'object with allOf and multiple schema on the allOf',
@@ -39,6 +39,22 @@ test('object with allOf and multiple schema on the allOf', (t) => {
3939
}
4040
const stringify = build(schema)
4141

42+
try {
43+
stringify({
44+
id: 1
45+
})
46+
} catch (e) {
47+
t.is(e.message, 'name is required!')
48+
}
49+
50+
try {
51+
stringify({
52+
name: 'string'
53+
})
54+
} catch (e) {
55+
t.is(e.message, 'id is required!')
56+
}
57+
4258
try {
4359
const value = stringify({
4460
id: 1,

0 commit comments

Comments
 (0)