bring server files into project.
This commit is contained in:
15
src/lib/server/test/getDiceRoll.test.ts
Normal file
15
src/lib/server/test/getDiceRoll.test.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import { describe, it } from "node:test";
|
||||
import { getDiceRoll } from "../../getDiceRoll";
|
||||
import { deepEqual } from "node:assert/strict";
|
||||
|
||||
function testRandom() {
|
||||
const val = [0, 0.2, 0.5, 0.5, 0.7, 0.9];
|
||||
return () => val.shift()!;
|
||||
}
|
||||
|
||||
describe("getDiceRoll", () => {
|
||||
it("should return an array of numbers from 1 to 6 with a given length", () => {
|
||||
let rand = getDiceRoll(6, testRandom());
|
||||
deepEqual(rand, [0, 1, 3, 3, 4, 6]);
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user