Files
factorio-expcluster/exp_reports/test/messages.test.js
T
bbassieandClaude Opus 5.5 12ac7052a1 Move exp_reports to ES modules and declare its permissions
Same changes the other packages got in #475 and #476. The permissions move
from definePermission calls into the plugin declaration, with the
Permissions augmentation in messages.ts so the web build sees it.
"type": "module", .js entrypoints and imports, webpack.config.cjs, and the
tap tests use import with --type-strip-only.

The web plugin now uses a default export function instead of the
deprecated BaseWebPlugin class, like exp_roles.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-26 23:22:18 +00:00

62 lines
1.4 KiB
JavaScript

import t from "tap";
import * as messages from "../dist/node/messages.js";
import { testMatrix, testRoundTripJsonSerialisable } from "../../test/common.js";
const sampleReport = new messages.ReportRecord(7, "bob", "alice", "griefing", "EXP", 12345);
t.test("class ReportRecord", t2 => {
testRoundTripJsonSerialisable(t2, messages.ReportRecord, testMatrix(
[7], // id
["bob"], // playerName
["alice"], // byPlayerName
["griefing"], // reason
["", "EXP"], // instanceName
[0, 12345], // updatedAtMs
[false, true], // isDeleted
));
t2.end();
});
t.test("class ReportUpdatedEvent", t2 => {
testRoundTripJsonSerialisable(t2, messages.ReportUpdatedEvent, testMatrix(
[[], [sampleReport]], // updates
));
t2.end();
});
t.test("class ReportListRequest", t2 => {
testRoundTripJsonSerialisable(t2, messages.ReportListRequest, testMatrix(
[undefined, "bob"], // playerName
));
t2.end();
});
t.test("class ReportGetRequest", t2 => {
testRoundTripJsonSerialisable(t2, messages.ReportGetRequest, testMatrix(
[7], // id
));
t2.end();
});
t.test("class ReportCreateRequest", t2 => {
testRoundTripJsonSerialisable(t2, messages.ReportCreateRequest, testMatrix(
["bob"], // playerName
["griefing"], // reason
["", "alice"], // byPlayerName
));
t2.end();
});
t.test("class ReportDeleteRequest", t2 => {
testRoundTripJsonSerialisable(t2, messages.ReportDeleteRequest, testMatrix(
[7], // id
));
t2.end();
});