-
Notifications
You must be signed in to change notification settings - Fork 0
/
fizzbuzz.test.ts
58 lines (50 loc) · 985 Bytes
/
fizzbuzz.test.ts
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
// const fizzbuzz = require('./js');
import {
isFizzy,
isBuzzy,
fizzyBuzzy,
fizzBuzz,
FIZZ,
BUZZ,
FIZZBUZZ,
} from './fizzbuzz'
test('sanity check', () => {});
test('isFizzy()', () => {
expect(isFizzy(4)).toBe(false)
expect(isFizzy(0)).toBe(true)
expect(isFizzy(3)).toBe(true)
})
test('isBuzzy()', () => {
expect(isBuzzy(8)).toBe(false)
expect(isBuzzy(0)).toBe(true)
expect(isBuzzy(5)).toBe(true)
})
test('fizzyBuzzy()', () => {
expect(fizzyBuzzy(0)).toBe('fizzbuzz')
expect(fizzyBuzzy(12)).toBe('fizz')
expect(fizzyBuzzy(100)).toBe('buzz')
expect(fizzyBuzzy(15)).toBe('fizzbuzz')
})
test('fizzBuzz()', () => {
const primeFizz = {
count: 3,
fizz: 1,
buzz: 0,
fizzBuzz: 0
}
const primeBuzz = {
count: 5,
fizz: 1,
buzz: 1,
fizzBuzz: 0
}
const primeFizzBuzz = {
count: 15,
fizz: 4,
buzz: 2,
fizzBuzz: 1
}
expect(fizzBuzz(3)).toEqual(primeFizz)
expect(fizzBuzz(5)).toEqual(primeBuzz)
expect(fizzBuzz(15)).toEqual(primeFizzBuzz)
})