-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.spec.js
155 lines (128 loc) · 4.5 KB
/
index.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
const {expect} = require('chai');
const {sum, mult, isAdult, sortArray, permuteAPalindrome, isOddNumber,isEvenNumber} = require('../index.js');
describe ('function sum must only accept numbers', () => {
it('should function sum not be NaN',() => {
expect(sum(2,NaN), 'Input is NaN').be.NaN;
} );
it('should function sum inputs be numbers',() => {
expect(sum(2,'a8'), 'Not a Number').not.be.a('number');
} );
});
describe ('function sum', () => {
it('should function sum equals 10',() => {
expect(sum(2,8)).equal(10);
} );
it('should function sum equals 25',() => {
expect(sum(2,23)).equal(25);
} );
it('should function sum not equals 0', () => {
expect(sum(2,9)).not.eq(0);
});
});
describe ('function mult must only accept numbers', () => {
it('should function mult not be NaN',() => {
expect(mult(2,NaN), 'Not a Number').be.NaN;
} );
it('should function sum inputs be numbers',() => {
expect(mult(2,'a8'), 'Not a Number').to.be.a('number');
} );
});
describe ('function mult', () => {
it('should function mult equals 10', () => {
// assert.equal(mult(2, 7), 14);
expect(mult(2,5)).eq(10);
});
it('should function mult equals 18', () => {
// assert.notEqual(mult(2, 4), 6);
expect(mult(2,9)).eq(18);
});
it('should function mult not equals 0', () => {
// assert.notEqual(mult(2, 4), 6);
expect(mult(2,3)).not.eq(0);
});
});
describe ('function isAdult must only accept numbers', () => {
it('should function isAdult input not be NaN',() => {
expect(isAdult(15)).not.equal('Error input');
} );
it('should function isAdult inputs be numbers',() => {
expect(isAdult(23)).not.equal('Error input');
} );
});
describe ('isAdult', () => {
it('should function isAdult be true', () => {
// assert.equal(isAdult(32), true);
expect(isAdult(22)).true;
});
it('should function isAdult be false', () => {
// assert.notEqual(isAdult(17), true);
expect(isAdult(16)).false;
});
});
describe ('should function sortArray input be Array', () => {
it('Is input of function sortArray Array?', () => {
expect(sortArray([1,2,3,6,5,8,9,0]),'Input not Array').not.equal('Error input');
});
});
describe ('sortArray', () => {
it('should function sortArray be equal to sorted array', () => {
expect(sortArray([5,4,3,2,6,7])).deep.equal([2,3,4,5,6,7]);
});
it('should function sortArray be equal to sorted array', () => {
expect(sortArray([9,0,7,8,5,6,4,3,2,1])).deep.equal([0,1,2,3,4,5,6,7,8,9]);
});
it('should function sortArray be equal to sorted array', () => {
expect(sortArray([5,4,3,2,6,7])).deep.equal([2,3,4,5,6,7]);
});
});
describe ('Should input of function permuteAPalindrome be string', () => {
it('Is input of function permuteAPalindrome string?', () => {
expect(permuteAPalindrome(123456), 'Not a string').eq('Input not a String');
});
});
describe ('permuteAPalindrome', () => {
it('should function permuteAPalindrome be equal to true', () => {
// assert.equal(permuteAPalindrome('amdam'), true );
expect(permuteAPalindrome('adkladklg')).true;
});
it('should function permuteAPalindrome be equal to false', () => {
// assert.equal(permuteAPalindrome('amdam'), true );
expect(permuteAPalindrome('adkladklgt')).false;
});
});
describe('Should input of function isEvenNumber be a number', () =>{
it('Is input of function isEvenNumber NaN?',() => {
expect(isEvenNumber(NaN)).eq('Input is NaN');
});
it('Is input of function isEvenNumber number?',() => {
expect(isEvenNumber('12')).eq('Input not a Number');
});
});
describe ('isEvenNumber', () => {
it('should function isEvenNumber check if is true',() => {
// assert.equal(isEvenNumber(6),true);
expect(isEvenNumber(12)).true;
} );
it('should function isEvenNumber check if is even', () => {
// assert.notEqual(sum(7),true);
expect(isEvenNumber(11)).false;
});
});
describe('Should input of function isOddNumber be a number', () =>{
it('Is input of function isOddNumber NaN?',() => {
expect(isOddNumber(NaN)).eq('Input is NaN');
});
it('Is input of function isOddNumber number?',() => {
expect(isOddNumber('12')).eq('Input not a Number');
});
});
describe ('isOddNumber', () => {
it('should function isOddNumber check if is true',() => {
// assert.equal(isEvenNumber(6),true);
expect(isOddNumber(12)).false;
} );
it('should function isOddNumber check if is even', () => {
// assert.notEqual(sum(7),true);
expect(isOddNumber(11)).true;
});
});