From d6051158e52db719ae506fc48a45d22975b16a8b Mon Sep 17 00:00:00 2001 From: Marcin Chrzanowski Date: Wed, 23 Aug 2017 20:19:52 -0400 Subject: Implement again --- __tests__/dice.test.js | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to '__tests__') diff --git a/__tests__/dice.test.js b/__tests__/dice.test.js index 15941cb..a18584c 100644 --- a/__tests__/dice.test.js +++ b/__tests__/dice.test.js @@ -9,7 +9,8 @@ const { negative, explode, keepHigh, - keepLow + keepLow, + again } = require('../src/dice.js') const defaultNumberRolls = 500 @@ -534,3 +535,28 @@ describe('keep', () => { testDie(die, basicDieTestSpecs(1, 20)) }) }) + +describe('again', () => { + describe('10A1d10', () => { + const die = again(constant(10), d(constant(1), constant(10))) + + testDie(die, { + variableDiceCount: { + min: 1, + max: Infinity + }, + average: { + average: 6.11 + }, + variance: { + variance: 19.03 + }, + bounds: { + low: 1, + high: Infinity, + expectLow: true, + expectHigh: false + } + }) + }) +}) -- cgit v1.2.3