16 lines
532 B
JavaScript
16 lines
532 B
JavaScript
const s = require("../src/js/sr2ini.js");
|
|
|
|
describe ("test function rollForInitiative()", () => {
|
|
test("function should accept numbes as integers as well as strings", () => {
|
|
expect(typeof s.rollForInitiative("1", "5")).toBe("number");
|
|
expect(typeof s.rollForInitiative(1, 5)).toBe("number");
|
|
});
|
|
|
|
test("result should be greater than zero", () => {
|
|
expect(s.rollForInitiative("1", "5")).toBeGreaterThan(0);
|
|
});
|
|
|
|
test("should return zero for bad parameters", () => {
|
|
expect(s.rollForInitiative("a", 2)).toBe(0);
|
|
});
|
|
}); |