forked from ealush/vest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
spec.js
45 lines (43 loc) · 1.54 KB
/
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
import isNegative from '.';
describe('Tests isNegative rule', () => {
describe('First argument is negative', () => {
describe('When first argument negative number', () => {
it('Should return true for negative numer', () => {
expect(isNegative(-1)).toBe(true);
});
it('should return true for negative desimal number', () => {
expect(isNegative(-1.1)).toBe(true);
});
it('should return true for negative string number', () => {
expect(isNegative('-1')).toBe(true);
});
it('should return true for negative decimal string number', () => {
expect(isNegative('-1.10')).toBe(true);
});
});
describe('When argument positive number', () => {
it('should return false for positive number', () => {
expect(isNegative(10)).toBe(false);
});
it('should return false for positive desimal number', () => {
expect(isNegative(10.1)).toBe(false);
});
it('should return false for positive string number', () => {
expect(isNegative('10')).toBe(false);
});
});
describe('When argument undefined or null or string', () => {
it('should return false for undefined value', () => {
expect(isNegative()).toBe(false);
});
it('should return false for null value', () => {
expect(isNegative(null)).toBe(false);
});
});
describe('Expose isPositive ', () => {
it('Should expose negativeForm property', () => {
expect(isNegative.negativeForm).toBe('isPositive');
});
});
});
});