-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patharmstrong-numbers.spec.js
43 lines (35 loc) · 1.15 KB
/
armstrong-numbers.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
import { validate } from './armstrong-numbers';
describe('ArmstrongNumber', () => {
test('Single digit numbers are Armstrong numbers', () => {
const input = 5;
expect(validate(input)).toBe(true);
});
test('There are no 2 digit Armstrong numbers', () => {
const input = 10;
expect(validate(input)).toBe(false);
});
test('Three digit number that is an Armstrong number', () => {
const input = 153;
expect(validate(input)).toBe(true);
});
test('Three digit number that is not an Armstrong number', () => {
const input = 100;
expect(validate(input)).toBe(false);
});
test('Four digit number that is an Armstrong number', () => {
const input = 9474;
expect(validate(input)).toBe(true);
});
test('Four digit number that is not an Armstrong number', () => {
const input = 9475;
expect(validate(input)).toBe(false);
});
test('Seven digit number that is an Armstrong number', () => {
const input = 9926315;
expect(validate(input)).toBe(true);
});
test('Seven digit number that is not an Armstrong number', () => {
const input = 9926314;
expect(validate(input)).toBe(false);
});
});