-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfizz-buzz.test.ts
76 lines (70 loc) · 1.91 KB
/
fizz-buzz.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import { createFizzBuzz } from "./fizz-buzz";
// Boundaries and Equivalence Partitions
// Triangulation Green Bar Pattern
// Test cases (.each())
// Also remember:
// - 3 laws
// - red-green-refactor
// - Fake It Green Bar Pattern
describe('fizz-buzz', () => {
describe('fizz', () => {
test.each([
{input:3},
{input:6},
{input:9},
])('$input', ({input}) => {
// Arrange
const expected = "Fizz"
const sut = createFizzBuzz();
// Act
const actual = sut.go(input);
// Assert
expect(actual).toBe(expected);
})
})
describe('buzz', () => {
test.each([
{input:5},
{input:10},
{input:20},
])('$input', ({input}) => {
// Arrange
const expected = "Buzz"
const sut = createFizzBuzz();
// Act
const actual = sut.go(input);
// Assert
expect(actual).toBe(expected);
})
})
describe('fizzbuzz', () => {
test.each([
{input:15},
{input:30},
{input:45},
])('$input', ({input}) => {
// Arrange
const expected = "FizzBuzz"
const sut = createFizzBuzz();
// Act
const actual = sut.go(input);
// Assert
expect(actual).toBe(expected);
})
})
describe('number itself', () => {
test.each([
{input:1, expected:"1"},
{input:2, expected:"2"},
{input:4, expected:"4"},
{input:76, expected:"76"},
])('$input', ({input, expected}) => {
// Arrange
const sut = createFizzBuzz();
// Act
const actual = sut.go(input);
// Assert
expect(actual).toBe(expected);
})
})
})