// this fails:
expect([{ foo: 123 }, { foo: 456 }]).to.matchPattern([{ foo: _.isNumber }]);
// this passes:
expect([{ foo: 123 }, { foo: 456 }]).to.matchPattern(x => x.length > 0 && x.map(y => expect(y).to.matchPattern({ foo: _.isNumber })));
What do you think about making the first expectation passing?
And it would be good to have a simpler way to write the second expectation (the additional check is length above 0).
Maybe the interface could be similar to Joi.
What do you think about making the first expectation passing?
And it would be good to have a simpler way to write the second expectation (the additional check is length above 0).
Maybe the interface could be similar to Joi.