Switch to jest
This commit is contained in:
parent
b6bb22dc81
commit
af07168c5b
11 changed files with 2534 additions and 8248 deletions
23
spec/rolls/roll-utils.spec.ts
Normal file
23
spec/rolls/roll-utils.spec.ts
Normal file
|
@ -0,0 +1,23 @@
|
|||
import { isDiceSwapNecessary } from "../../src/module/rolls/roll-utils";
|
||||
|
||||
describe("Utility function testing if dice swap is necessary", () => {
|
||||
it("Should not swap if all dice are crit successes.", () => {
|
||||
expect(isDiceSwapNecessary([[1, 1, 1], []], 9)).toBeFalsy();
|
||||
});
|
||||
|
||||
it("Should not swap if no die is crit success.", () => {
|
||||
expect(isDiceSwapNecessary([[], [2, 2, 2]], 9)).toBeFalsy();
|
||||
});
|
||||
|
||||
it("Should not swap if all dice are already in use", () => {
|
||||
expect(isDiceSwapNecessary([[1], [9, 8]], 10)).toBeFalsy();
|
||||
});
|
||||
|
||||
it("Should not swap if result does not get any better", () => {
|
||||
expect(isDiceSwapNecessary([[1], [8]], 4)).toBeFalsy();
|
||||
});
|
||||
|
||||
it("Should swap if result does get better", () => {
|
||||
expect(isDiceSwapNecessary([[1], [19]], 18)).toBeTruthy();
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue