Skip to content

Commit de89496

Browse files
committed
Updated test
1 parent 4364395 commit de89496

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

test/additionalProperties.test.js

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,3 +180,60 @@ test('additionalProperties - throw on unknown type', (t) => {
180180
t.pass()
181181
}
182182
})
183+
184+
test('nested additionalProperties', (t) => {
185+
t.plan(1)
186+
const stringify = build({
187+
title: 'additionalProperties',
188+
type: 'array',
189+
items: {
190+
type: 'object',
191+
properties: {
192+
ap: {
193+
type: 'object',
194+
additionalProperties: { type: 'string' }
195+
}
196+
}
197+
}
198+
})
199+
200+
let obj = [{ ap: { value: 'string' } }]
201+
t.equal('[{"ap":{"value":"string"}}]', stringify(obj))
202+
})
203+
204+
test('very nested additionalProperties', (t) => {
205+
t.plan(1)
206+
const stringify = build({
207+
title: 'additionalProperties',
208+
type: 'array',
209+
items: {
210+
type: 'object',
211+
properties: {
212+
ap: {
213+
type: 'object',
214+
properties: {
215+
nested: {
216+
type: 'object',
217+
properties: {
218+
moarNested: {
219+
type: 'object',
220+
properties: {
221+
finally: {
222+
type: 'object',
223+
additionalProperties: {
224+
type: 'string'
225+
}
226+
}
227+
}
228+
}
229+
}
230+
}
231+
}
232+
}
233+
}
234+
}
235+
})
236+
237+
let obj = [{ ap: { nested: { moarNested: { finally: { value: 'str' } } } } }]
238+
t.equal('[{"ap":{"nested":{"moarNested":{"finally":{"value":"str"}}}}}]', stringify(obj))
239+
})

0 commit comments

Comments
 (0)