You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
681 B

'use strict'
const test = require('tap').test
const build = require('..')
test('use enum without type', (t) => {
t.plan(1)
const stringify = build({
title: 'Example Schema',
type: 'object',
properties: {
order: {
type: 'string',
enum: ['asc', 'desc']
}
}
})
const obj = { order: 'asc' }
t.equal('{"order":"asc"}', stringify(obj))
})
test('use enum without type', (t) => {
t.plan(1)
const stringify = build({
title: 'Example Schema',
type: 'object',
properties: {
order: {
enum: ['asc', 'desc']
}
}
})
const obj = { order: 'asc' }
t.equal('{"order":"asc"}', stringify(obj))
})