From 14ffff1985dacc83aab2f4f491ec00038817b6bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20R=C3=BCmpelein?= Date: Thu, 7 Jan 2021 02:33:22 +0100 Subject: [PATCH] Fix tests. --- spec/support/ds4rolls/executor.spec.ts | 16 ++++++++++------ src/module/rolls/roll-data.ts | 8 ++++---- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/spec/support/ds4rolls/executor.spec.ts b/spec/support/ds4rolls/executor.spec.ts index eff0bce8..98978b20 100644 --- a/spec/support/ds4rolls/executor.spec.ts +++ b/spec/support/ds4rolls/executor.spec.ts @@ -110,7 +110,7 @@ describe("DS4 Rolls with multiple dice and no modifiers.", () => { it("Should succeed normally with all rolls crit successes.", () => { expect(rollCheckMultipleDice(48, {}, [1, 1, 1])).toEqual( - new RollResult(48, RollResultStatus.SUCCESS, [1, 1, 1]), + new RollResult(48, RollResultStatus.CRITICAL_SUCCESS, [1, 1, 1]), ); }); @@ -151,16 +151,20 @@ describe("DS4 Rolls with multiple dice and no modifiers.", () => { }); it("Should maximize on 2-dice 'lowest dice higher than last CTN and crit success thrown'-Edge case, no change required.", () => { - expect(rollCheckMultipleDice(24, {}, [1, 8])).toEqual(new RollResult(20, RollResultStatus.SUCCESS, [1, 8])); + expect(rollCheckMultipleDice(24, {}, [1, 8])).toEqual( + new RollResult(20, RollResultStatus.CRITICAL_SUCCESS, [1, 8]), + ); }); it("Should maximize on 2-dice 'lowest dice higher than last CTN and crit success thrown'-Edge case, change required.", () => { - expect(rollCheckMultipleDice(38, {}, [1, 19])).toEqual(new RollResult(37, RollResultStatus.SUCCESS, [1, 19])); + expect(rollCheckMultipleDice(38, {}, [1, 19])).toEqual( + new RollResult(37, RollResultStatus.CRITICAL_SUCCESS, [1, 19]), + ); }); it("Should maximize correctly when swapping with more than one crit success", () => { expect(rollCheckMultipleDice(48, {}, [1, 1, 15])).toEqual( - new RollResult(43, RollResultStatus.SUCCESS, [1, 1, 15]), + new RollResult(43, RollResultStatus.CRITICAL_SUCCESS, [1, 1, 15]), ); }); }); @@ -174,7 +178,7 @@ describe("DS4 Rolls with multiple dice and min/max modifiers.", () => { it("Should succeed with all rolls crit successes (1 and 2).", () => { expect(rollCheckMultipleDice(48, { maxCritSucc: 2, minCritFail: 19 }, [2, 1, 2])).toEqual( - new RollResult(48, RollResultStatus.SUCCESS, [2, 1, 2]), + new RollResult(48, RollResultStatus.CRITICAL_SUCCESS, [2, 1, 2]), ); }); @@ -214,7 +218,7 @@ describe("DS4 Rolls with multiple dice and fail modifiers.", () => { describe("DS4 Rolls with multiple dice and success modifiers.", () => { it("Should succeed with all rolls crit successes (1 and 2).", () => { expect(rollCheckMultipleDice(48, { maxCritSucc: 2 }, [2, 1, 2])).toEqual( - new RollResult(48, RollResultStatus.SUCCESS, [2, 1, 2]), + new RollResult(48, RollResultStatus.CRITICAL_SUCCESS, [2, 1, 2]), ); }); }); diff --git a/src/module/rolls/roll-data.ts b/src/module/rolls/roll-data.ts index 0f298f7e..ef98b436 100644 --- a/src/module/rolls/roll-data.ts +++ b/src/module/rolls/roll-data.ts @@ -36,8 +36,8 @@ export class RollResult { } export enum RollResultStatus { - FAILURE, - SUCCESS, - CRITICAL_FAILURE, - CRITICAL_SUCCESS, + FAILURE = "FAILURE", + SUCCESS = "SUCCESS", + CRITICAL_FAILURE = "CRITICAL_FAILURE", + CRITICAL_SUCCESS = "CRITICAL_SUCCESS", }