Switch to jest

This commit is contained in:
Johannes Loher 2021-02-11 13:42:38 +01:00
parent b6bb22dc81
commit af07168c5b
11 changed files with 2534 additions and 8248 deletions

View file

@ -1,4 +1,3 @@
import "jasmine";
import * as fs from "fs-extra";
import * as path from "path";

View file

@ -1,7 +1,5 @@
import { rollCheckMultipleDice, rollCheckSingleDie } from "../../../src/module/rolls/roll-executor";
import "jasmine";
import { RollResult, RollResultStatus } from "../../../src/module/rolls/roll-data";
import { RollResult, RollResultStatus } from "../../src/module/rolls/roll-data";
import { rollCheckMultipleDice, rollCheckSingleDie } from "../../src/module/rolls/roll-executor";
describe("DS4 Rolls with one die and no modifications.", () => {
it("Should do a regular success roll.", () => {

View file

@ -1,24 +1,23 @@
import "jasmine";
import { isDiceSwapNecessary } from "../../../src/module/rolls/roll-utils";
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)).toBeFalse();
expect(isDiceSwapNecessary([[1, 1, 1], []], 9)).toBeFalsy();
});
it("Should not swap if no die is crit success.", () => {
expect(isDiceSwapNecessary([[], [2, 2, 2]], 9)).toBeFalse();
expect(isDiceSwapNecessary([[], [2, 2, 2]], 9)).toBeFalsy();
});
it("Should not swap if all dice are already in use", () => {
expect(isDiceSwapNecessary([[1], [9, 8]], 10)).toBeFalse();
expect(isDiceSwapNecessary([[1], [9, 8]], 10)).toBeFalsy();
});
it("Should not swap if result does not get any better", () => {
expect(isDiceSwapNecessary([[1], [8]], 4)).toBeFalse();
expect(isDiceSwapNecessary([[1], [8]], 4)).toBeFalsy();
});
it("Should swap if result does get better", () => {
expect(isDiceSwapNecessary([[1], [19]], 18)).toBeTrue();
expect(isDiceSwapNecessary([[1], [19]], 18)).toBeTruthy();
});
});

View file

@ -1,7 +0,0 @@
{
"spec_dir": "spec",
"spec_files": ["**/*[sS]pec.ts"],
"helpers": ["helpers/**/*.ts"],
"stopSpecOnExpectationFailure": false,
"random": true
}

7
spec/tsconfig.spec.json Normal file
View file

@ -0,0 +1,7 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"types": ["foundry-vtt-types", "jest"]
},
"include": ["src", "./"]
}