const { pointBuyCost, POINT_BUY_BUDGET, STANDARD_ARRAY, effectiveDiceMode } = require('./buildFlow'); describe('point buy', () => { test('all eights cost nothing', () => { expect(pointBuyCost({ STR: 8, DEX: 8, CON: 8, INT: 8, WIS: 8, CHA: 8 })).toBe(0); }); test('the classic 15/15/15/8/8/8 spends exactly the budget', () => { expect(pointBuyCost({ STR: 15, DEX: 15, CON: 15, INT: 8, WIS: 8, CHA: 8 })).toBe(POINT_BUY_BUDGET); }); test('14 and 15 cost two points a step', () => { expect(pointBuyCost({ STR: 13 })).toBe(5); expect(pointBuyCost({ STR: 14 })).toBe(7); expect(pointBuyCost({ STR: 15 })).toBe(9); }); test('a score out of range is refused', () => { expect(pointBuyCost({ STR: 16 })).toBeNull(); expect(pointBuyCost({ STR: 7 })).toBeNull(); }); }); test('the standard array is the six usual scores', () => { expect(STANDARD_ARRAY).toEqual([15, 14, 13, 12, 10, 8]); }); describe('effectiveDiceMode', () => { test('a campaign with one kind of dice decides for everyone', () => { expect(effectiveDiceMode({ diceMode: 'PHYSICAL' }, { diceMode: 'DIGITAL' })).toBe('PHYSICAL'); expect(effectiveDiceMode({ diceMode: 'DIGITAL' }, { diceMode: 'PHYSICAL' })).toBe('DIGITAL'); }); test('BOTH leaves it to the character', () => { expect(effectiveDiceMode({ diceMode: 'BOTH' }, { diceMode: 'PHYSICAL' })).toBe('PHYSICAL'); }); });