Restructure single-dice tests.

This commit is contained in:
Oliver Rümpelein 2020-12-30 23:58:01 +01:00
parent dcf60ef59e
commit 3526e6ab99

View file

@ -1,8 +1,8 @@
import { rollCheckSingleDie, RollOptions, RollResult, RollResultStatus } from "../../src/module/rolls/roll-executor";
import { RollProvider } from "../../src/module/rolls/roll-provider";
describe("DS4 Rolls", () => {
it("Should do a proper single success roll.", () => {
describe("DS4 Rolls with one die and no modifications.", () => {
it("Should do a regular success roll.", () => {
const rollProvider: RollProvider = jasmine.createSpyObj("rollProvider", ["getNextRoll"]);
rollProvider.getNextRoll = jasmine.createSpy("getNextRoll").and.returnValue(4);
@ -12,7 +12,7 @@ describe("DS4 Rolls", () => {
);
});
it("Should do a proper single success roll on success edge case.", () => {
it("Should do a single success roll on success upper edge case.", () => {
const rollProvider: RollProvider = jasmine.createSpyObj("rollProvider", ["getNextRoll"]);
rollProvider.getNextRoll = jasmine.createSpy("getNextRoll").and.returnValue(4);
@ -22,7 +22,7 @@ describe("DS4 Rolls", () => {
);
});
it("Should do a proper single failure roll, lower bound", () => {
it("Should do a single failure roll on lower edge case.", () => {
const rollProvider: RollProvider = jasmine.createSpyObj("rollProvider", ["getNextRoll"]);
rollProvider.getNextRoll = jasmine.createSpy("getNextRoll").and.returnValue(5);
@ -32,7 +32,7 @@ describe("DS4 Rolls", () => {
);
});
it("Should do a proper single failure roll, upper bound", () => {
it("Should do a single failure roll on upper edge case '19'.", () => {
const rollProvider: RollProvider = jasmine.createSpyObj("rollProvider", ["getNextRoll"]);
rollProvider.getNextRoll = jasmine.createSpy("getNextRoll").and.returnValue(19);
@ -42,7 +42,7 @@ describe("DS4 Rolls", () => {
);
});
it("Should do a proper single crit success roll.", () => {
it("Should do a single crit success roll on '1'.", () => {
const rollProvider: RollProvider = jasmine.createSpyObj("rollProvider", ["getNextRoll"]);
rollProvider.getNextRoll = jasmine.createSpy("getNextRoll").and.returnValue(1);
@ -52,7 +52,7 @@ describe("DS4 Rolls", () => {
);
});
it("Should do a proper single crit failure roll.", () => {
it("Should do a single crit failure roll on '20'.", () => {
const rollProvider: RollProvider = jasmine.createSpyObj("rollProvider", ["getNextRoll"]);
rollProvider.getNextRoll = jasmine.createSpy("getNextRoll").and.returnValue(20);
@ -61,8 +61,10 @@ describe("DS4 Rolls", () => {
new RollResult(0, RollResultStatus.CRITICAL_FAILURE, [20]),
);
});
});
it("Should do a proper crit success with changed bounds, lower bound", () => {
describe("DS4 Rolls with one die and crit roll modifications.", () => {
it("Should do a crit success on `1`.", () => {
const rollProvider: RollProvider = jasmine.createSpyObj("rollProvider", ["getNextRoll"]);
rollProvider.getNextRoll = jasmine.createSpy("getNextRoll").and.returnValue(1);
@ -71,7 +73,7 @@ describe("DS4 Rolls", () => {
);
});
it("Should do a proper crit success with changed bounds, upper bound", () => {
it("Should do a crit success on `maxCritSucc`.", () => {
const rollProvider: RollProvider = jasmine.createSpyObj("rollProvider", ["getNextRoll"]);
rollProvider.getNextRoll = jasmine.createSpy("getNextRoll").and.returnValue(2);
@ -80,7 +82,7 @@ describe("DS4 Rolls", () => {
);
});
it("Should do a proper success with changed bounds, lower bound", () => {
it("Should do a success on lower edge case `3`.", () => {
const rollProvider: RollProvider = jasmine.createSpyObj("rollProvider", ["getNextRoll"]);
rollProvider.getNextRoll = jasmine.createSpy("getNextRoll").and.returnValue(3);
@ -89,7 +91,7 @@ describe("DS4 Rolls", () => {
);
});
it("Should do a proper success with changed bounds, lower bound", () => {
it("Should do a success on upper edge case `18`.", () => {
const rollProvider: RollProvider = jasmine.createSpyObj("rollProvider", ["getNextRoll"]);
rollProvider.getNextRoll = jasmine.createSpy("getNextRoll").and.returnValue(18);
@ -98,7 +100,7 @@ describe("DS4 Rolls", () => {
);
});
it("Should do a proper crit fail with changed bounds, lower bound", () => {
it("Should do a crit fail on `minCritFail`.", () => {
const rollProvider: RollProvider = jasmine.createSpyObj("rollProvider", ["getNextRoll"]);
rollProvider.getNextRoll = jasmine.createSpy("getNextRoll").and.returnValue(19);
@ -107,7 +109,7 @@ describe("DS4 Rolls", () => {
);
});
it("Should do a proper crit fail with changed bounds, upper bound", () => {
it("Should do a crit fail on `20`", () => {
const rollProvider: RollProvider = jasmine.createSpyObj("rollProvider", ["getNextRoll"]);
rollProvider.getNextRoll = jasmine.createSpy("getNextRoll").and.returnValue(20);