Add missing cases for test <20.
This commit is contained in:
parent
4209b8eb14
commit
b3c89b4d32
2 changed files with 55 additions and 1 deletions
|
@ -61,4 +61,58 @@ describe("DS4 Rolls", () => {
|
||||||
new RollResult(0, RollResultStatus.CRITICAL_FAILURE, [20]),
|
new RollResult(0, RollResultStatus.CRITICAL_FAILURE, [20]),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("Should do a proper crit success with changed bounds, lower bound", () => {
|
||||||
|
const rollProvider: RollProvider = jasmine.createSpyObj("rollProvider", ["getNextRoll"]);
|
||||||
|
|
||||||
|
rollProvider.getNextRoll = jasmine.createSpy("getNextRoll").and.returnValue(1);
|
||||||
|
expect(rollCheckSingleDie(4, { maxCritSucc: 2, minCritFail: 19 }, rollProvider)).toEqual(
|
||||||
|
new RollResult(4, RollResultStatus.CRITICAL_SUCCESS, [1]),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Should do a proper crit success with changed bounds, upper bound", () => {
|
||||||
|
const rollProvider: RollProvider = jasmine.createSpyObj("rollProvider", ["getNextRoll"]);
|
||||||
|
|
||||||
|
rollProvider.getNextRoll = jasmine.createSpy("getNextRoll").and.returnValue(2);
|
||||||
|
expect(rollCheckSingleDie(4, { maxCritSucc: 2, minCritFail: 19 }, rollProvider)).toEqual(
|
||||||
|
new RollResult(4, RollResultStatus.CRITICAL_SUCCESS, [2]),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Should do a proper success with changed bounds, lower bound", () => {
|
||||||
|
const rollProvider: RollProvider = jasmine.createSpyObj("rollProvider", ["getNextRoll"]);
|
||||||
|
|
||||||
|
rollProvider.getNextRoll = jasmine.createSpy("getNextRoll").and.returnValue(3);
|
||||||
|
expect(rollCheckSingleDie(4, { maxCritSucc: 2, minCritFail: 19 }, rollProvider)).toEqual(
|
||||||
|
new RollResult(3, RollResultStatus.SUCCESS, [3]),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Should do a proper success with changed bounds, lower bound", () => {
|
||||||
|
const rollProvider: RollProvider = jasmine.createSpyObj("rollProvider", ["getNextRoll"]);
|
||||||
|
|
||||||
|
rollProvider.getNextRoll = jasmine.createSpy("getNextRoll").and.returnValue(18);
|
||||||
|
expect(rollCheckSingleDie(4, { maxCritSucc: 2, minCritFail: 19 }, rollProvider)).toEqual(
|
||||||
|
new RollResult(0, RollResultStatus.FAILURE, [18]),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Should do a proper crit fail with changed bounds, lower bound", () => {
|
||||||
|
const rollProvider: RollProvider = jasmine.createSpyObj("rollProvider", ["getNextRoll"]);
|
||||||
|
|
||||||
|
rollProvider.getNextRoll = jasmine.createSpy("getNextRoll").and.returnValue(19);
|
||||||
|
expect(rollCheckSingleDie(4, { maxCritSucc: 2, minCritFail: 19 }, rollProvider)).toEqual(
|
||||||
|
new RollResult(0, RollResultStatus.CRITICAL_FAILURE, [19]),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Should do a proper crit fail with changed bounds, upper bound", () => {
|
||||||
|
const rollProvider: RollProvider = jasmine.createSpyObj("rollProvider", ["getNextRoll"]);
|
||||||
|
|
||||||
|
rollProvider.getNextRoll = jasmine.createSpy("getNextRoll").and.returnValue(20);
|
||||||
|
expect(rollCheckSingleDie(4, { maxCritSucc: 2, minCritFail: 19 }, rollProvider)).toEqual(
|
||||||
|
new RollResult(0, RollResultStatus.CRITICAL_FAILURE, [20]),
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -75,7 +75,7 @@ function rollCheckMultipleDice(testValue: number, rollOptions: RollOptions): Rol
|
||||||
}
|
}
|
||||||
|
|
||||||
export class RollOptions {
|
export class RollOptions {
|
||||||
constructor(public minCritFail: number = 20, public maxCritSucc: number = 1) {}
|
constructor(public maxCritSucc: number = 1, public minCritFail: number = 20) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class RollResult {
|
export class RollResult {
|
||||||
|
|
Loading…
Reference in a new issue