-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
98 lines (66 loc) · 2.11 KB
/
test.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
"use strict";
var expect = require('chai').expect;
var fullhouse = require('./yatzy-test-suite/fullhouse.js');
var yatzy = require('./yatzy-test-suite/yatzy.js');
var smallStraight = require('./yatzy-test-suite/smallStraight.js');
var straight = require('./yatzy-test-suite/straight.js');
describe('fullhouse(dicesArray)', function () {
it('should return true if dice roll is a pair of dice and 3 of the same dice', function () {
// 1. ARRANGE
var dices = [3,3,2,2,2];
// 2. ACT
let result = fullhouse(dices);
// 3. ASSERT
expect(result).to.be.equal(true);
});
});
describe('yatzy(dicesArray)', function () {
it('should return true if all dice are the same value', function () {
// 1. ARRANGE
var dices = [4,4,4,4,4];
// 2. ACT
let result = yatzy(dices);
// 3. ASSERT
expect(result).to.be.equal(true);
});
});
describe('smallStraight(dicesArray)', function () {
it('should return true if 4 dices are in an ascending row', function () {
// 1. ARRANGE
var dices = [1,3,2,0,1];
// 2. ACT
let result = smallStraight(dices);
// 3. ASSERT
expect(result).to.be.equal(true);
});
});
describe('smallStraight(dicesArray)', function () {
it('should return false if there is no sequence of 4 numbers in a row', function () {
// 1. ARRANGE
var dices = [1,0,2,2,2];
// 2. ACT
let result = smallStraight(dices);
// 3. ASSERT
expect(result).to.be.equal(false);
});
});
describe('straight(dicesArray)', function () {
it('should return true if 5 numbers in ascending order', function () {
// 1. ARRANGE
var dices = [0,1,2,3,4];
// 2. ACT
let result = straight(dices);
// 3. ASSERT
expect(result).to.be.equal(true);
});
});
describe('Straight_Return_False_Test(dicesArray)', function () {
it('should return false if there are not 5 numbers in ascending order', function () {
// 1. ARRANGE
var dices = [0,1,2,3,2];
// 2. ACT
let result = straight(dices);
// 3. ASSERT
expect(result).to.be.equal(false);
});
});