-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathisInteger.spec.js
47 lines (40 loc) · 1.14 KB
/
isInteger.spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
const assert = require('assert');
const {expect} = require('chai');
const {isInteger} = require('../index');
describe('function isInteger', () => {
it('should return true for integer number', () => {
assert.equal(isInteger(1), true);
});
// Chai
it('should return true for integer number', () => {
expect(isInteger(1)).true;
});
it('should return false for not integer number', () => {
assert.equal(isInteger(0.1), false);
});
// Chai
it('should return false for not integer number', () => {
expect(isInteger(0.1)).false;
});
it('should return false for NaN value', () => {
assert.equal(isInteger(NaN), false);
});
// Chai
it('should return false for NaN value', () => {
expect(isInteger(NaN)).false;
});
it('should return false for string value', () => {
assert.equal(isInteger('1'), false);
});
// Chai
it('should return false for string value', () => {
expect(isInteger('1')).false;
});
it('should return false for empty value', () => {
assert.equal(isInteger(''), false);
});
// Chai
it('should return false for empty value', () => {
expect(isInteger('')).false;
});
});