UNPKG

@pfx/base

Version:

Plugin with basic operations for pf, the fast and extensible command-line data (e.g. JSON) processor and transformer

20 lines (17 loc) 628 B
const {anything, array, assert, constant, property} = require('fast-check') const {func: marshaller} = require('./string') test('returns input as toString with newlines', () => { const err = [] const argv = anything().chain(verbose => constant({verbose})) const values = array(anything()).map(values => values.filter(value => value !== null && typeof value !== 'undefined')) assert( property(argv, values, (argv, values) => { const str = values.map(value => value.toString() + '\n').join('') expect( marshaller(argv)(values) ).toStrictEqual( {err, str} ) }) ) })