Use testType for tests to reduce redundancy
This commit is contained in:
parent
e8f0733091
commit
22cd794ec8
1 changed files with 7 additions and 7 deletions
14
test.js
14
test.js
|
|
@ -89,7 +89,11 @@ const types = new Map([
|
||||||
Object.create(null),
|
Object.create(null),
|
||||||
new Object() // eslint-disable-line no-new-object
|
new Object() // eslint-disable-line no-new-object
|
||||||
]],
|
]],
|
||||||
['integer', 6]
|
['integer', 6],
|
||||||
|
['infinite', [
|
||||||
|
Infinity,
|
||||||
|
-Infinity
|
||||||
|
]]
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// This ensures a certain method matches only the types
|
// This ensures a certain method matches only the types
|
||||||
|
|
@ -125,7 +129,7 @@ test('is.string', t => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('is.number', t => {
|
test('is.number', t => {
|
||||||
testType(t, 'number', ['nan', 'integer']);
|
testType(t, 'number', ['nan', 'integer', 'infinite']);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('is.boolean', t => {
|
test('is.boolean', t => {
|
||||||
|
|
@ -360,9 +364,5 @@ test('is.inRange', t => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('is.infinite', t => {
|
test('is.infinite', t => {
|
||||||
t.true(m.infinite(Infinity));
|
testType(t, 'infinite', ['number']);
|
||||||
t.true(m.infinite(-Infinity));
|
|
||||||
t.false(m.infinite(NaN));
|
|
||||||
t.false(m.infinite(5));
|
|
||||||
t.false(m.infinite('hello world'));
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue