Added 'type checking' tests

This commit is contained in:
alex 2020-07-20 16:28:53 +03:00
parent abef4aeeac
commit f2863e0339

View file

@ -652,6 +652,19 @@ test('is.array', t => {
t.throws(() => {
assert.array([1, '2'], assert.number);
});
t.notThrows(() => {
const x: unknown[] = [1, 2, 3];
assert.array(x, assert.number);
x[0].toFixed(0);
});
t.notThrows(() => {
const x: unknown[] = [1, 2, 3];
if (is.array<number>(x, is.number)) {
x[0].toFixed(0);
}
});
});
test('is.function', t => {