1
0

test that invalid constructor forms throw

This commit is contained in:
Adrian Wannenmacher 2026-02-15 04:41:40 +01:00
parent 2a2472a052
commit f073129f38
Signed by: tfld
GPG Key ID: 19D986ECB1E492D5
4 changed files with 24 additions and 0 deletions

View File

@ -23,6 +23,12 @@ export default function() {
);
});
QUnit.test("invalid constructor", function(assert) {
assert.throws(
function() {new Game("nope", "absolutely", "not"); },
new TypeError("unknown form of Game constructor"));
});
QUnit.test("low goal", function(assert) {
assert.throws(
function() { new Game(0); },

View File

@ -13,6 +13,12 @@ export default function() {
assert.true(round.canRaise(Team.They), "they initially can raise");
});
QUnit.test("invalid constructor", function(assert) {
assert.throws(
function() {new Round("nope", "absolutely", "not"); },
new TypeError("unknown form of Round constructor"));
});
QUnit.test("immediate victory", function(assert) {
let round = new Round();
round.winner = Team.We;

View File

@ -11,6 +11,12 @@ export default function() {
assert.strictEqual(rr.winner, Team.We, "correct winner");
});
QUnit.test("invalid constructor", function(assert) {
assert.throws(
function() {new RoundResult("nope", "absolutely", "not"); },
new TypeError("unknown form of RoundResult constructor"));
});
QUnit.test("toStruct", function(assert) {
let rr = new RoundResult(2, Team.They);
let struct = rr.toStruct();

View File

@ -19,6 +19,12 @@ export default function() {
assert.strictEqual(session.theirTeam, "", "their team name");
});
QUnit.test("invalid constructor", function(assert) {
assert.throws(
function() {new Session("nope", "absolutely", "not"); },
new TypeError("unknown form of Session constructor"));
});
QUnit.test("set goal", function(assert) {
let session = new Session();
assert.strictEqual(session.goal, 11, "initial goal");