Fix assertion message for .all and .any (#132)

This commit is contained in:
Dave Cohen 2021-04-22 04:00:08 -05:00 committed by GitHub
parent 5ed7e9bb40
commit b748ab72b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 50 additions and 4 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 => {
@ -1570,6 +1591,20 @@ test('is.all', t => {
t.throws(() => {
assert.all(is.string);
});
t.throws(() => {
assert.all(is.string, 1, 2, 3);
}, {
// Removes duplicates:
message: /received values of types `number`./
});
t.throws(() => {
assert.all(is.string, 1, [4]);
}, {
// Lists all types:
message: /received values of types `number`, `Array`./
});
});
test('assert', t => {