@serverkgg/bridge 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -2
- package/rules/package.md +60 -0
- package/src/blog/articleFrontmatter.test.ts +10 -10
- package/src/blog/compile.test.ts +9 -9
- package/src/bot/botDeploy.test.ts +16 -16
- package/src/bot/botEnvironment.test.ts +8 -8
- package/src/bot/botIdentity.test.ts +12 -12
- package/src/bot/botPanel.test.ts +13 -13
- package/src/bot/botPanel.ts +4 -4
- package/src/bot/botState.test.ts +3 -3
- package/src/bot/botTerminal.test.ts +5 -5
- package/src/bot/botVariables.test.ts +8 -8
- package/src/bot/detect/botToken.test.ts +6 -6
- package/src/bot/detect/detect.test.ts +21 -21
- package/src/bot/detect/detectTable.test.ts +5 -5
- package/src/bot/detect/envExample.test.ts +2 -2
- package/src/bot/detect/envScan.test.ts +4 -4
- package/src/bot/detect/inferBotPlatform.test.ts +4 -4
- package/src/bot/detect/keys.test.ts +3 -3
- package/src/bot/detect/sensitiveKey.test.ts +5 -5
- package/src/bot/detect/serverkJson.test.ts +5 -5
- package/src/catalogs/curseforge.test.ts +35 -35
- package/src/catalogs/thunderstore.test.ts +9 -9
- package/src/cli/detectTable.test.ts +3 -3
- package/src/cli/link.test.ts +11 -11
- package/src/cli/main.ts +8 -0
- package/src/cli/rules.test.ts +198 -0
- package/src/cli/rules.ts +188 -0
- package/src/cli/validate.test.ts +52 -30
- package/src/cli/validate.ts +2 -0
- package/src/codecs/ini.test.ts +13 -13
- package/src/codecs/javaProperties.test.ts +11 -11
- package/src/codecs/sourceCfg.test.ts +14 -14
- package/src/codecs/xmlProperties.test.ts +10 -10
- package/src/core/bridgePort.test.ts +6 -6
- package/src/core/bridgeUserError.test.ts +4 -4
- package/src/core/bridgeValue.test.ts +5 -5
- package/src/core/describeDownloadFailure.test.ts +12 -12
- package/src/core/describeDownloadFailure.ts +10 -10
- package/src/guides/markdown.test.ts +31 -31
- package/src/install/installStamp.test.ts +9 -9
- package/src/manifest/extension.ts +36 -0
- package/src/manifest/index.ts +1 -0
- package/src/manifest/manifest.test.ts +208 -90
- package/src/manifest/manifest.ts +34 -0
- package/src/net/loopback.test.ts +10 -10
- package/src/presence/rosterSync.test.ts +7 -7
- package/src/probes/a2s.test.ts +5 -5
- package/src/probes/minecraftPing.test.ts +17 -17
- package/src/probes/raknetPing.test.ts +13 -13
- package/src/rcon/rconAccess.test.ts +20 -20
- package/src/rcon/rconAccess.ts +13 -13
- package/src/rcon/rconClient.test.ts +49 -49
- package/src/rcon/rconFrame.test.ts +14 -14
- package/src/rcon/rconIds.test.ts +4 -4
- package/src/rcon/rconWriter.test.ts +6 -6
- package/src/runtime/bridgeActivity.test.ts +15 -15
- package/src/runtime/bridgeBackupLease.test.ts +9 -9
- package/src/runtime/bridgeConfigReader.test.ts +5 -5
- package/src/runtime/bridgeConsoleHandler.test.ts +8 -8
- package/src/runtime/bridgeContext.test.ts +5 -5
- package/src/runtime/bridgeDriver.test.ts +94 -94
- package/src/runtime/bridgeEvents.test.ts +15 -15
- package/src/runtime/bridgeFiles.test.ts +54 -54
- package/src/runtime/bridgeInstall.test.ts +10 -10
- package/src/runtime/bridgeLiveConfig.test.ts +6 -6
- package/src/runtime/bridgePending.test.ts +6 -6
- package/src/runtime/bridgeRedaction.test.ts +16 -16
- package/src/runtime/bridgeRegistry.test.ts +52 -52
- package/src/runtime/bridgeRegistry.ts +2 -2
- package/src/runtime/bridgeServer.test.ts +31 -31
- package/src/runtime/bridgeSetup.test.ts +27 -27
- package/src/runtime/bridgeSetup.ts +1 -1
- package/src/runtime/bridgeSetupHandlers.test.ts +13 -13
- package/src/runtime/bridgeSignal.test.ts +7 -7
- package/src/runtime/bridgeSupervisor.test.ts +42 -42
- package/src/runtime/serve.ts +4 -4
- package/src/steam/avatars.test.ts +13 -13
- package/src/steam/steamApp.test.ts +8 -8
- package/src/steam/steamcmd.test.ts +17 -17
- package/src/steam/steamcmd.ts +4 -4
- package/src/steam/steamcmdNarrator.test.ts +4 -4
- package/src/steam/workshop.test.ts +5 -5
- package/src/utils/changedSettingKeys.test.ts +5 -5
- package/src/utils/describeExecFailure.test.ts +4 -4
- package/src/utils/describeExecFailure.ts +1 -1
- package/src/utils/sameSettingValue.test.ts +7 -7
- package/src/utils/token.test.ts +7 -7
- package/src/wine/protonCommand.test.ts +5 -5
- package/src/wine/wineCommand.test.ts +6 -6
- package/src/wine/winePrefix.test.ts +6 -6
- package/src/wire/activity.test.ts +8 -8
- package/src/wire/panel.test.ts +28 -28
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { describe, expect,
|
|
1
|
+
import { describe, expect, it } from "bun:test";
|
|
2
2
|
import { createRconWriter } from "./rconWriter";
|
|
3
3
|
|
|
4
4
|
const bytes = (...values: number[]) => new Uint8Array(values);
|
|
@@ -17,7 +17,7 @@ const recorder = (accept: (writes: number) => number | null) => {
|
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
describe("createRconWriter", () => {
|
|
20
|
-
|
|
20
|
+
it("reports a full write and keeps nothing pending", () => {
|
|
21
21
|
const socket = recorder(() => null);
|
|
22
22
|
const writer = createRconWriter(socket.write);
|
|
23
23
|
|
|
@@ -35,7 +35,7 @@ describe("createRconWriter", () => {
|
|
|
35
35
|
expect(writer.dead).toBe(false);
|
|
36
36
|
});
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
it("buffers the remainder of a short write and finishes it on drain", () => {
|
|
39
39
|
const socket = recorder((writes) => (writes === 1 ? 2 : null));
|
|
40
40
|
const writer = createRconWriter(socket.write);
|
|
41
41
|
|
|
@@ -57,7 +57,7 @@ describe("createRconWriter", () => {
|
|
|
57
57
|
]);
|
|
58
58
|
});
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
it("appends a send made while a remainder is pending", () => {
|
|
61
61
|
const socket = recorder((writes) => (writes === 1 ? 1 : null));
|
|
62
62
|
const writer = createRconWriter(socket.write);
|
|
63
63
|
|
|
@@ -74,7 +74,7 @@ describe("createRconWriter", () => {
|
|
|
74
74
|
]);
|
|
75
75
|
});
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
it("reports zero accepted and dies when the socket answers minus one", () => {
|
|
78
78
|
const socket = recorder(() => -1);
|
|
79
79
|
const writer = createRconWriter(socket.write);
|
|
80
80
|
|
|
@@ -84,7 +84,7 @@ describe("createRconWriter", () => {
|
|
|
84
84
|
expect(socket.writes).toHaveLength(1);
|
|
85
85
|
});
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
it("does not write on a drain with an empty buffer", () => {
|
|
88
88
|
const socket = recorder(() => null);
|
|
89
89
|
const writer = createRconWriter(socket.write);
|
|
90
90
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { describe, expect,
|
|
1
|
+
import { describe, expect, it } from "bun:test";
|
|
2
2
|
import type { BridgeActivity, BridgeValues } from "../core";
|
|
3
3
|
import {
|
|
4
4
|
BRIDGE_ACTIVITY_DETAILS_LIMIT,
|
|
@@ -69,14 +69,14 @@ const granted = (subject = "Steve"): BridgeActivity => ({
|
|
|
69
69
|
});
|
|
70
70
|
|
|
71
71
|
describe("normalizeActivity", () => {
|
|
72
|
-
|
|
72
|
+
it("keeps a well-formed entry as it is", () => {
|
|
73
73
|
const { options, warnings } = recorder();
|
|
74
74
|
|
|
75
75
|
expect(normalizeActivity(granted(), options)).toEqual(granted());
|
|
76
76
|
expect(warnings).toEqual([]);
|
|
77
77
|
});
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
it("drops a name the protocol does not know, with a warning", () => {
|
|
80
80
|
const { options, warnings } = recorder();
|
|
81
81
|
|
|
82
82
|
expect(
|
|
@@ -99,7 +99,7 @@ describe("normalizeActivity", () => {
|
|
|
99
99
|
]);
|
|
100
100
|
});
|
|
101
101
|
|
|
102
|
-
|
|
102
|
+
it("drops an entry whose text is empty in one language", () => {
|
|
103
103
|
const { options } = recorder();
|
|
104
104
|
|
|
105
105
|
expect(
|
|
@@ -116,7 +116,7 @@ describe("normalizeActivity", () => {
|
|
|
116
116
|
).toBeNull();
|
|
117
117
|
});
|
|
118
118
|
|
|
119
|
-
|
|
119
|
+
it("cuts the text and the subject to their limits", () => {
|
|
120
120
|
const { options, warnings } = recorder();
|
|
121
121
|
|
|
122
122
|
const normalized = normalizeActivity(
|
|
@@ -140,7 +140,7 @@ describe("normalizeActivity", () => {
|
|
|
140
140
|
]);
|
|
141
141
|
});
|
|
142
142
|
|
|
143
|
-
|
|
143
|
+
it("keeps at most sixteen details", () => {
|
|
144
144
|
const { options } = recorder();
|
|
145
145
|
|
|
146
146
|
const details: BridgeValues = {};
|
|
@@ -160,7 +160,7 @@ describe("normalizeActivity", () => {
|
|
|
160
160
|
expect(Object.keys(normalized?.details ?? {})).toHaveLength(BRIDGE_ACTIVITY_DETAILS_LIMIT);
|
|
161
161
|
});
|
|
162
162
|
|
|
163
|
-
|
|
163
|
+
it("removes secret fields, reserved keys and values that are not scalars", () => {
|
|
164
164
|
const { options } = recorder();
|
|
165
165
|
|
|
166
166
|
const normalized = normalizeActivity(
|
|
@@ -185,7 +185,7 @@ describe("normalizeActivity", () => {
|
|
|
185
185
|
});
|
|
186
186
|
});
|
|
187
187
|
|
|
188
|
-
|
|
188
|
+
it("blanks a secret value in the text, the subject and the details", () => {
|
|
189
189
|
const { options } = recorder();
|
|
190
190
|
|
|
191
191
|
const normalized = normalizeActivity(
|
|
@@ -211,7 +211,7 @@ describe("normalizeActivity", () => {
|
|
|
211
211
|
});
|
|
212
212
|
|
|
213
213
|
describe("createActivityReporter", () => {
|
|
214
|
-
|
|
214
|
+
it("emits the entry as an event carrying the text under the reserved keys", () => {
|
|
215
215
|
const { reporter, emitted } = recorder();
|
|
216
216
|
|
|
217
217
|
reporter.report({
|
|
@@ -234,7 +234,7 @@ describe("createActivityReporter", () => {
|
|
|
234
234
|
]);
|
|
235
235
|
});
|
|
236
236
|
|
|
237
|
-
|
|
237
|
+
it("emits nothing for an entry normalisation drops", () => {
|
|
238
238
|
const { reporter, emitted } = recorder();
|
|
239
239
|
|
|
240
240
|
reporter.report({
|
|
@@ -247,7 +247,7 @@ describe("createActivityReporter", () => {
|
|
|
247
247
|
});
|
|
248
248
|
|
|
249
249
|
describe("createActivityScope", () => {
|
|
250
|
-
|
|
250
|
+
it("collects entries for the answer instead of emitting them", () => {
|
|
251
251
|
const { options, reporter, emitted } = recorder();
|
|
252
252
|
const scope = createActivityScope(reporter, options);
|
|
253
253
|
|
|
@@ -262,7 +262,7 @@ describe("createActivityScope", () => {
|
|
|
262
262
|
expect(emitted).toEqual([]);
|
|
263
263
|
});
|
|
264
264
|
|
|
265
|
-
|
|
265
|
+
it("drains what it collected to the ring when the handler throws", () => {
|
|
266
266
|
const { options, reporter, emitted } = recorder();
|
|
267
267
|
const scope = createActivityScope(reporter, options);
|
|
268
268
|
|
|
@@ -275,7 +275,7 @@ describe("createActivityScope", () => {
|
|
|
275
275
|
expect(scope.close()).toEqual([]);
|
|
276
276
|
});
|
|
277
277
|
|
|
278
|
-
|
|
278
|
+
it("sends a report made after the answer to the ring", () => {
|
|
279
279
|
const { options, reporter, emitted } = recorder();
|
|
280
280
|
const scope = createActivityScope(reporter, options);
|
|
281
281
|
|
|
@@ -288,7 +288,7 @@ describe("createActivityScope", () => {
|
|
|
288
288
|
]);
|
|
289
289
|
});
|
|
290
290
|
|
|
291
|
-
|
|
291
|
+
it("keeps at most eight entries on one answer", () => {
|
|
292
292
|
const { options, reporter, warnings } = recorder();
|
|
293
293
|
const scope = createActivityScope(reporter, options);
|
|
294
294
|
|
|
@@ -300,7 +300,7 @@ describe("createActivityScope", () => {
|
|
|
300
300
|
expect(warnings.filter((warning) => warning.fields?.reason === "extra-entries")).toHaveLength(2);
|
|
301
301
|
});
|
|
302
302
|
|
|
303
|
-
|
|
303
|
+
it("never throws into the caller, whatever the entry holds", () => {
|
|
304
304
|
const { options, reporter, warnings } = recorder();
|
|
305
305
|
const scope = createActivityScope(reporter, options);
|
|
306
306
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { describe, expect,
|
|
1
|
+
import { describe, expect, it } from "bun:test";
|
|
2
2
|
import { createBackupLease } from "./bridgeBackupLease";
|
|
3
3
|
|
|
4
4
|
describe("backup save ownership", () => {
|
|
5
|
-
|
|
5
|
+
it("keeps a long backup frozen while renewed and releases when its owner disappears", async () => {
|
|
6
6
|
let now = 0;
|
|
7
7
|
let releases = 0;
|
|
8
8
|
const lease = createBackupLease(
|
|
@@ -25,7 +25,7 @@ describe("backup save ownership", () => {
|
|
|
25
25
|
expect(releases).toBe(1);
|
|
26
26
|
expect(lease.active).toBe(false);
|
|
27
27
|
});
|
|
28
|
-
|
|
28
|
+
it("refuses overlapping holds and retains ownership after a failed resume", async () => {
|
|
29
29
|
let fail = true;
|
|
30
30
|
const lease = createBackupLease(async () => {
|
|
31
31
|
if (fail) {
|
|
@@ -43,7 +43,7 @@ describe("backup save ownership", () => {
|
|
|
43
43
|
});
|
|
44
44
|
});
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
it("reserves ownership while the quiesce operation is still awaiting confirmation", async () => {
|
|
47
47
|
const prepared = Promise.withResolvers<void>();
|
|
48
48
|
const lease = createBackupLease(async () => {});
|
|
49
49
|
const owner = lease.begin();
|
|
@@ -58,7 +58,7 @@ test("reserves ownership while the quiesce operation is still awaiting confirmat
|
|
|
58
58
|
await lease.finish(owner);
|
|
59
59
|
});
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
it("expiration waits for in-flight preparation before resuming saves", async () => {
|
|
62
62
|
let now = 0;
|
|
63
63
|
let releases = 0;
|
|
64
64
|
const prepared = Promise.withResolvers<void>();
|
|
@@ -83,7 +83,7 @@ test("expiration waits for in-flight preparation before resuming saves", async (
|
|
|
83
83
|
expect(lease.active).toBe(false);
|
|
84
84
|
});
|
|
85
85
|
|
|
86
|
-
|
|
86
|
+
it("late releases and tokenless callers cannot release a newer owner", async () => {
|
|
87
87
|
let releases = 0;
|
|
88
88
|
const lease = createBackupLease(async () => {
|
|
89
89
|
releases++;
|
|
@@ -99,7 +99,7 @@ test("late releases and tokenless callers cannot release a newer owner", async (
|
|
|
99
99
|
expect(releases).toBe(2);
|
|
100
100
|
});
|
|
101
101
|
|
|
102
|
-
|
|
102
|
+
it("legacy release is accepted only for a legacy hold", async () => {
|
|
103
103
|
let releases = 0;
|
|
104
104
|
const lease = createBackupLease(async () => {
|
|
105
105
|
releases++;
|
|
@@ -111,7 +111,7 @@ test("legacy release is accepted only for a legacy hold", async () => {
|
|
|
111
111
|
expect(releases).toBe(1);
|
|
112
112
|
});
|
|
113
113
|
|
|
114
|
-
|
|
114
|
+
it("failed quiesce cleanup keeps the owner until resume succeeds", async () => {
|
|
115
115
|
let releases = 0;
|
|
116
116
|
const lease = createBackupLease(async () => {
|
|
117
117
|
releases++;
|
|
@@ -127,7 +127,7 @@ test("failed quiesce cleanup keeps the owner until resume succeeds", async () =>
|
|
|
127
127
|
expect(lease.active).toBe(false);
|
|
128
128
|
});
|
|
129
129
|
|
|
130
|
-
|
|
130
|
+
it("legacy owners retain the historical hold until explicit release without renewal", async () => {
|
|
131
131
|
let now = 0;
|
|
132
132
|
let releases = 0;
|
|
133
133
|
const lease = createBackupLease(
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { describe, expect,
|
|
1
|
+
import { describe, expect, it } from "bun:test";
|
|
2
2
|
import { BridgeConfigError, parseConfig } from "./bridgeConfigReader";
|
|
3
3
|
|
|
4
4
|
const written = (extra: Record<string, unknown> = {}) => {
|
|
@@ -22,7 +22,7 @@ const written = (extra: Record<string, unknown> = {}) => {
|
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
describe("parseConfig", () => {
|
|
25
|
-
|
|
25
|
+
it("reads a file an older agent wrote, with no public address and no port counts", () => {
|
|
26
26
|
const config = parseConfig(written());
|
|
27
27
|
|
|
28
28
|
expect(config.publicAddress).toBeUndefined();
|
|
@@ -33,7 +33,7 @@ describe("parseConfig", () => {
|
|
|
33
33
|
});
|
|
34
34
|
});
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
it("reads the public address and the port counts when the agent wrote them", () => {
|
|
37
37
|
const config = parseConfig(
|
|
38
38
|
written({
|
|
39
39
|
publicAddress: "203.0.113.7",
|
|
@@ -51,7 +51,7 @@ describe("parseConfig", () => {
|
|
|
51
51
|
});
|
|
52
52
|
});
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
it("ignores a malformed public address and drops non-numeric counts", () => {
|
|
55
55
|
const config = parseConfig(
|
|
56
56
|
written({
|
|
57
57
|
publicAddress: 7,
|
|
@@ -68,7 +68,7 @@ describe("parseConfig", () => {
|
|
|
68
68
|
});
|
|
69
69
|
});
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
it("still refuses a game that would run as root", () => {
|
|
72
72
|
expect(() =>
|
|
73
73
|
parseConfig(
|
|
74
74
|
written({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { describe, expect,
|
|
1
|
+
import { describe, expect, it } from "bun:test";
|
|
2
2
|
import type { BridgeCommandOptions, BridgeContext, BridgeReply } from "../context";
|
|
3
3
|
import { BridgeKind, BridgeUserError } from "../core";
|
|
4
4
|
import type { BridgeDriver, BridgeTerminalModule } from "../modules";
|
|
@@ -60,7 +60,7 @@ const handlerFor = (driver: BridgeDriver) => {
|
|
|
60
60
|
};
|
|
61
61
|
|
|
62
62
|
describe("routing a console line to the driver before the game's stdin", () => {
|
|
63
|
-
|
|
63
|
+
it("answers with the driver's reply when the driver handles the line", async () => {
|
|
64
64
|
const { handler, written } = handlerFor(
|
|
65
65
|
driverWith(
|
|
66
66
|
terminalWith(async (_context, input) => {
|
|
@@ -81,7 +81,7 @@ describe("routing a console line to the driver before the game's stdin", () => {
|
|
|
81
81
|
expect(written).toEqual([]);
|
|
82
82
|
});
|
|
83
83
|
|
|
84
|
-
|
|
84
|
+
it("hands the driver the same line the caller typed", async () => {
|
|
85
85
|
const seen: string[] = [];
|
|
86
86
|
|
|
87
87
|
const { handler } = handlerFor(
|
|
@@ -105,7 +105,7 @@ describe("routing a console line to the driver before the game's stdin", () => {
|
|
|
105
105
|
]);
|
|
106
106
|
});
|
|
107
107
|
|
|
108
|
-
|
|
108
|
+
it("writes the line to stdin when the driver answers null", async () => {
|
|
109
109
|
const { handler, written } = handlerFor(
|
|
110
110
|
driverWith(
|
|
111
111
|
terminalWith(async () => {
|
|
@@ -124,7 +124,7 @@ describe("routing a console line to the driver before the game's stdin", () => {
|
|
|
124
124
|
]);
|
|
125
125
|
});
|
|
126
126
|
|
|
127
|
-
|
|
127
|
+
it("keeps the expect and timeout of a line the driver leaves alone", async () => {
|
|
128
128
|
const { handler } = handlerFor(
|
|
129
129
|
driverWith(
|
|
130
130
|
terminalWith(async () => {
|
|
@@ -143,7 +143,7 @@ describe("routing a console line to the driver before the game's stdin", () => {
|
|
|
143
143
|
).toBe("matched");
|
|
144
144
|
});
|
|
145
145
|
|
|
146
|
-
|
|
146
|
+
it("writes the line to stdin when the driver declares no handler", async () => {
|
|
147
147
|
const { handler, written } = handlerFor(
|
|
148
148
|
driverWith({
|
|
149
149
|
kind: BridgeKind.Terminal,
|
|
@@ -158,7 +158,7 @@ describe("routing a console line to the driver before the game's stdin", () => {
|
|
|
158
158
|
]);
|
|
159
159
|
});
|
|
160
160
|
|
|
161
|
-
|
|
161
|
+
it("writes the line to stdin when the game declares no terminal at all", async () => {
|
|
162
162
|
const { handler, written } = handlerFor(driverWith(undefined));
|
|
163
163
|
|
|
164
164
|
await handler("list", {});
|
|
@@ -168,7 +168,7 @@ describe("routing a console line to the driver before the game's stdin", () => {
|
|
|
168
168
|
]);
|
|
169
169
|
});
|
|
170
170
|
|
|
171
|
-
|
|
171
|
+
it("refuses the line with the driver's own text when the driver rejects it", async () => {
|
|
172
172
|
const refusal = {
|
|
173
173
|
ar: "هذا الأمر يشتغل داخل اللعبة بس.",
|
|
174
174
|
en: "That command only works inside the game.",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { afterEach, beforeEach, describe, expect,
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, it } from "bun:test";
|
|
2
2
|
import { mkdtemp, rm, writeFile } from "node:fs/promises";
|
|
3
3
|
import { tmpdir } from "node:os";
|
|
4
4
|
import { join } from "node:path";
|
|
@@ -38,7 +38,7 @@ describe("the context's variable maps", () => {
|
|
|
38
38
|
});
|
|
39
39
|
});
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
it("hand a driver every variable and secret the agent wrote, and follow a rewrite", async () => {
|
|
42
42
|
const boot = configWith(
|
|
43
43
|
{
|
|
44
44
|
MY_VAR: "1",
|
|
@@ -185,7 +185,7 @@ describe("the context's ports and address", () => {
|
|
|
185
185
|
});
|
|
186
186
|
});
|
|
187
187
|
|
|
188
|
-
|
|
188
|
+
it("hand a driver the block the agent published and its public address", async () => {
|
|
189
189
|
const boot = configWith({
|
|
190
190
|
portCounts: {
|
|
191
191
|
game: 1,
|
|
@@ -209,7 +209,7 @@ describe("the context's ports and address", () => {
|
|
|
209
209
|
expect(context.server.publicAddress).toBe("203.0.113.7");
|
|
210
210
|
});
|
|
211
211
|
|
|
212
|
-
|
|
212
|
+
it("treat every port as a single one and the address as unknown for a file an older agent wrote", async () => {
|
|
213
213
|
const boot = configWith({});
|
|
214
214
|
|
|
215
215
|
await writeFile(path, JSON.stringify(boot));
|
|
@@ -224,7 +224,7 @@ describe("the context's ports and address", () => {
|
|
|
224
224
|
expect(() => context.portBlock("query")).toThrow('this game declares no port named "query"');
|
|
225
225
|
});
|
|
226
226
|
|
|
227
|
-
|
|
227
|
+
it("follow a rewrite of the public address", async () => {
|
|
228
228
|
const boot = configWith({});
|
|
229
229
|
|
|
230
230
|
await writeFile(path, JSON.stringify(boot));
|