Add getValuesMessage option for assertType

This commit is contained in:
Dave Cohen 2021-04-11 11:38:48 -05:00
parent 5ed7e9bb40
commit 5b13eeedda
2 changed files with 30 additions and 3 deletions

View file

@ -1529,6 +1529,27 @@ test('is.any', t => {
t.throws(() => {
assert.any(is.string);
});
t.throws(() => {
assert.any(is.string, 1, 2, 3);
}, {
// Removes duplicates:
message: /received values of types `number`./
});
t.throws(() => {
assert.any(is.string, 1, [4]);
}, {
// Lists all types:
message: /received values of types `number`, `Array`./
});
t.throws(() => {
assert.any([is.string, is.nullOrUndefined], 1);
}, {
// Handles array as first argument:
message: /received values of types `number`./
});
});
test('is.all', t => {