-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathLottoJudgeTest.js
More file actions
41 lines (36 loc) · 1.21 KB
/
LottoJudgeTest.js
File metadata and controls
41 lines (36 loc) · 1.21 KB
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
import LottoJudge from "../src/service/LottoJudge";
import { PRIZES } from "../src/util/Rank";
describe("로또 판단하는 클래스 테스트", () => {
test("로또 판단하는 judge 함수 정상 작동하는지 확인", () => {
expect(() => {
const lottoJudge = new LottoJudge([1, 2, 3, 4, 5], 6);
return lottoJudge
.judge([1, 2, 3, 4, 5])
.toStictEqual({ rank: 1, prize: PRIZES[1] });
});
expect(() => {
const lottoJudge = new LottoJudge([1, 2, 3, 4, 5], 6);
return lottoJudge
.judge([1, 2, 3, 4, 6])
.toStictEqual({ rank: 2, prize: PRIZES[2] });
});
expect(() => {
const lottoJudge = new LottoJudge([1, 2, 3, 4, 5], 6);
return lottoJudge
.judge([1, 2, 3, 4, 8])
.toStictEqual({ rank: 3, prize: PRIZES[3] });
});
expect(() => {
const lottoJudge = new LottoJudge([1, 2, 3, 4, 5], 6);
return lottoJudge
.judge([1, 2, 3, 8, 9])
.toStictEqual({ rank: 4, prize: PRIZES[4] });
});
expect(() => {
const lottoJudge = new LottoJudge([1, 2, 3, 4, 5], 6);
return lottoJudge
.judge([1, 2, 8, 9, 10])
.toStictEqual({ rank: 5, prize: PRIZES[5] });
});
});
});