pxi
Version:
Small, fast, and magical command-line data processor
20 lines (17 loc) • 605 B
JavaScript
const {anything, array, assert, constant, property} = require('fast-check')
const {func: serializer} = require('./id')
test('returns input as toString without newlines', () => {
const err = []
const argv = anything().map(verbose => constant({verbose}))
const jsons = array(anything()).map(jsons => jsons.filter(json => typeof json !== 'undefined' && json !== null))
assert(
property(argv, jsons, (argv, jsons) => {
const str = jsons.map(json => json.toString()).join('')
expect(
serializer(argv)(jsons)
).toStrictEqual(
{err, str}
)
})
)
})