m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/__tests__
diff options
context:
space:
mode:
authorMarcin Chrzanowski <marcin.j.chrzanowski@gmail.com>2017-07-15 17:49:49 -0400
committerMarcin Chrzanowski <marcin.j.chrzanowski@gmail.com>2017-07-15 17:50:09 -0400
commitd939daae10c15b00652bf87625d87ad2eed1ce39 (patch)
tree0e1538e11322816dc8927f46df5ddc0482fec6da /__tests__
parentab75ff5d633f1c85b3ac7496e9d22809f461483d (diff)
Handle 0 dice
Diffstat (limited to '__tests__')
-rw-r--r--__tests__/dice.test.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/__tests__/dice.test.js b/__tests__/dice.test.js
index 5d3fac1..9f3106e 100644
--- a/__tests__/dice.test.js
+++ b/__tests__/dice.test.js
@@ -40,7 +40,7 @@ expect.extend({
toAllBe(received, expected) {
const pass = received.reduce((allOk, value) => {
return allOk && value === expected
- })
+ }, true)
return {
pass,
@@ -74,7 +74,7 @@ const rollForTest = (die, numberRolls) => {
for (let i = 0; i < numberRolls; i++) {
let rolled = pool(die)
pools.push(rolled)
- rolls.push(rolled.reduce(plus))
+ rolls.push(rolled.reduce(plus, 0))
}
return { pools, rolls }
@@ -263,6 +263,7 @@ describe('constant', () => {
describe('basic dice', () => {
describeBasicDie(1, 6)
+ describeBasicDie(0, 6)
describeBasicDie(2, 8, 500)
describeBasicDie(20, 1)
})