@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
package/src/steam/steamcmd.ts
CHANGED
|
@@ -106,14 +106,14 @@ export const steamcmdUpdateArgs = (appId: string, update: SteamcmdUpdateOptions)
|
|
|
106
106
|
export const steamcmdFailureText = (result: BridgeExecResult, label: string): LocalizedText => {
|
|
107
107
|
if (`${result.stdout}\n${result.stderr}`.includes(NO_SUBSCRIPTION)) {
|
|
108
108
|
return {
|
|
109
|
-
ar:
|
|
110
|
-
en: `Steam refused to download ${label} because the download account
|
|
109
|
+
ar: `رفض Steam تنزيل ${label} لأن حساب التنزيل لا يملكه. تواصل مع الدعم.`,
|
|
110
|
+
en: `Steam refused to download ${label} because the download account doesn't own it. Contact support.`,
|
|
111
111
|
};
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
return {
|
|
115
|
-
ar:
|
|
116
|
-
en: `We
|
|
115
|
+
ar: `تعذّر تنزيل ${label} من Steam، جرب مرة ثانية.`,
|
|
116
|
+
en: `We couldn't download ${label} from Steam. Try again.`,
|
|
117
117
|
};
|
|
118
118
|
};
|
|
119
119
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { describe, expect,
|
|
1
|
+
import { describe, expect, it } from "bun:test";
|
|
2
2
|
import type { BridgeLog } from "../context";
|
|
3
3
|
import type { BridgeValues } from "../core";
|
|
4
4
|
import { steamcmdNarrator } from "./steamcmdNarrator";
|
|
@@ -20,7 +20,7 @@ const recorder = () => {
|
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
describe("steamcmdNarrator", () => {
|
|
23
|
-
|
|
23
|
+
it("reports download progress in ten percent steps", () => {
|
|
24
24
|
const { log, lines, fields } = recorder();
|
|
25
25
|
const narrate = steamcmdNarrator(log, "palworld");
|
|
26
26
|
|
|
@@ -57,7 +57,7 @@ describe("steamcmdNarrator", () => {
|
|
|
57
57
|
]);
|
|
58
58
|
});
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
it("starts counting again when the phase changes", () => {
|
|
61
61
|
const { log, fields } = recorder();
|
|
62
62
|
const narrate = steamcmdNarrator(log, "rust");
|
|
63
63
|
|
|
@@ -74,7 +74,7 @@ describe("steamcmdNarrator", () => {
|
|
|
74
74
|
]);
|
|
75
75
|
});
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
it("passes notable lines through with the ansi stripped", () => {
|
|
78
78
|
const { log, lines } = recorder();
|
|
79
79
|
const narrate = steamcmdNarrator(log, "rust");
|
|
80
80
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { describe, expect,
|
|
1
|
+
import { describe, expect, it } from "bun:test";
|
|
2
2
|
import { workshopContentPath, workshopDownloadArgs, workshopFormBody } from "./workshop";
|
|
3
3
|
|
|
4
4
|
describe("workshopFormBody", () => {
|
|
5
|
-
|
|
5
|
+
it("writes the count and the indexed ids", () => {
|
|
6
6
|
expect(
|
|
7
7
|
workshopFormBody("itemcount", [
|
|
8
8
|
"450814997",
|
|
@@ -11,7 +11,7 @@ describe("workshopFormBody", () => {
|
|
|
11
11
|
).toBe("itemcount=2&publishedfileids%5B0%5D=450814997&publishedfileids%5B1%5D=1234");
|
|
12
12
|
});
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
it("names the count field the collection api expects", () => {
|
|
15
15
|
expect(
|
|
16
16
|
workshopFormBody("collectioncount", [
|
|
17
17
|
"1",
|
|
@@ -21,7 +21,7 @@ describe("workshopFormBody", () => {
|
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
describe("workshopDownloadArgs", () => {
|
|
24
|
-
|
|
24
|
+
it("asks steamcmd for every item", () => {
|
|
25
25
|
expect(
|
|
26
26
|
workshopDownloadArgs("440900", [
|
|
27
27
|
"1",
|
|
@@ -39,7 +39,7 @@ describe("workshopDownloadArgs", () => {
|
|
|
39
39
|
});
|
|
40
40
|
|
|
41
41
|
describe("workshopContentPath", () => {
|
|
42
|
-
|
|
42
|
+
it("points at where steamcmd unpacks an item", () => {
|
|
43
43
|
expect(workshopContentPath("440900", "12345")).toBe("steamapps/workshop/content/440900/12345");
|
|
44
44
|
});
|
|
45
45
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { describe, expect,
|
|
1
|
+
import { describe, expect, it } from "bun:test";
|
|
2
2
|
import { changedSettingKeys } from "./changedSettingKeys";
|
|
3
3
|
|
|
4
4
|
describe("changedSettingKeys", () => {
|
|
5
|
-
|
|
5
|
+
it("keeps only the keys whose value really changed", () => {
|
|
6
6
|
expect(
|
|
7
7
|
changedSettingKeys(
|
|
8
8
|
{
|
|
@@ -23,7 +23,7 @@ describe("changedSettingKeys", () => {
|
|
|
23
23
|
]);
|
|
24
24
|
});
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
it("counts a key the stored values do not hold as changed", () => {
|
|
27
27
|
expect(
|
|
28
28
|
changedSettingKeys(
|
|
29
29
|
{},
|
|
@@ -36,7 +36,7 @@ describe("changedSettingKeys", () => {
|
|
|
36
36
|
]);
|
|
37
37
|
});
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
it("counts every written key as changed when nothing could be read first", () => {
|
|
40
40
|
const written = {
|
|
41
41
|
difficulty: "hard",
|
|
42
42
|
pvp: false,
|
|
@@ -52,7 +52,7 @@ describe("changedSettingKeys", () => {
|
|
|
52
52
|
]);
|
|
53
53
|
});
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
it("answers nothing for an empty write", () => {
|
|
56
56
|
expect(
|
|
57
57
|
changedSettingKeys(
|
|
58
58
|
{
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { describe, expect,
|
|
1
|
+
import { describe, expect, it } from "bun:test";
|
|
2
2
|
import { describeExecFailure } from "./describeExecFailure";
|
|
3
3
|
|
|
4
4
|
describe("describeExecFailure", () => {
|
|
5
|
-
|
|
5
|
+
it("names the subject and the exit code in both languages", () => {
|
|
6
6
|
const text = describeExecFailure(
|
|
7
7
|
{
|
|
8
8
|
stdout: "",
|
|
@@ -13,12 +13,12 @@ describe("describeExecFailure", () => {
|
|
|
13
13
|
);
|
|
14
14
|
|
|
15
15
|
expect(text).toEqual({
|
|
16
|
-
ar: "Forge installer
|
|
16
|
+
ar: "فشل Forge installer بكود الخروج 1.",
|
|
17
17
|
en: "Forge installer failed with exit code 1.",
|
|
18
18
|
});
|
|
19
19
|
});
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
it("keeps the process output out of the customer text", () => {
|
|
22
22
|
const text = describeExecFailure(
|
|
23
23
|
{
|
|
24
24
|
stdout: "token=abc",
|
|
@@ -3,7 +3,7 @@ import type { LocalizedText } from "../core";
|
|
|
3
3
|
|
|
4
4
|
export const describeExecFailure = (result: BridgeExecResult, subject: string): LocalizedText => {
|
|
5
5
|
return {
|
|
6
|
-
ar:
|
|
6
|
+
ar: `فشل ${subject} بكود الخروج ${result.code}.`,
|
|
7
7
|
en: `${subject} failed with exit code ${result.code}.`,
|
|
8
8
|
};
|
|
9
9
|
};
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { describe, expect,
|
|
1
|
+
import { describe, expect, it } from "bun:test";
|
|
2
2
|
import { sameSettingValue } from "./sameSettingValue";
|
|
3
3
|
|
|
4
4
|
describe("sameSettingValue", () => {
|
|
5
|
-
|
|
5
|
+
it("treats a float the ini codec wrote as equal to the integer the form sends", () => {
|
|
6
6
|
expect(sameSettingValue("1.000000", 1)).toBe(true);
|
|
7
7
|
expect(sameSettingValue("1", "1.000000")).toBe(true);
|
|
8
8
|
});
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
it("treats decimals that differ only in trailing zeros as equal", () => {
|
|
11
11
|
expect(sameSettingValue("0.5", "0.50")).toBe(true);
|
|
12
12
|
});
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
it("treats boolean text as equal whatever its case", () => {
|
|
15
15
|
expect(sameSettingValue("True", "true")).toBe(true);
|
|
16
16
|
expect(sameSettingValue("False", false)).toBe(true);
|
|
17
17
|
expect(sameSettingValue(true, "FALSE")).toBe(false);
|
|
18
18
|
});
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
it("never treats an empty value as zero", () => {
|
|
21
21
|
expect(sameSettingValue("", "0")).toBe(false);
|
|
22
22
|
expect(sameSettingValue(null, 0)).toBe(false);
|
|
23
23
|
});
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
it("keeps a leading-zero string different from its number, since it may be an id", () => {
|
|
26
26
|
expect(sameSettingValue("01", "1")).toBe(false);
|
|
27
27
|
});
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
it("compares the trimmed text of anything else", () => {
|
|
30
30
|
expect(sameSettingValue(" easy ", "easy")).toBe(true);
|
|
31
31
|
expect(sameSettingValue("easy", "hard")).toBe(false);
|
|
32
32
|
expect(sameSettingValue("2", "3")).toBe(false);
|
package/src/utils/token.test.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { describe, expect,
|
|
1
|
+
import { describe, expect, it } from "bun:test";
|
|
2
2
|
import { generateToken, TOKEN_ALPHABET } from "./token";
|
|
3
3
|
|
|
4
4
|
describe("generateToken", () => {
|
|
5
|
-
|
|
5
|
+
it("returns a token of the requested length from the default alphabet", () => {
|
|
6
6
|
const token = generateToken(40);
|
|
7
7
|
|
|
8
8
|
expect(token).toHaveLength(40);
|
|
@@ -13,15 +13,15 @@ describe("generateToken", () => {
|
|
|
13
13
|
).toBe(true);
|
|
14
14
|
});
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
it("uses the alphabet it is given", () => {
|
|
17
17
|
expect(generateToken(32, "ab")).toMatch(/^[ab]{32}$/);
|
|
18
18
|
});
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
it("does not repeat itself", () => {
|
|
21
21
|
expect(generateToken(24)).not.toBe(generateToken(24));
|
|
22
22
|
});
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
it("draws every character of a small alphabet", () => {
|
|
25
25
|
const seen = new Set([
|
|
26
26
|
...generateToken(2000, "abc"),
|
|
27
27
|
]);
|
|
@@ -37,13 +37,13 @@ describe("generateToken", () => {
|
|
|
37
37
|
]);
|
|
38
38
|
});
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
it("refuses a length that is not a positive integer", () => {
|
|
41
41
|
expect(() => generateToken(0)).toThrow();
|
|
42
42
|
expect(() => generateToken(-4)).toThrow();
|
|
43
43
|
expect(() => generateToken(1.5)).toThrow();
|
|
44
44
|
});
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
it("refuses an unusable alphabet", () => {
|
|
47
47
|
expect(() => generateToken(8, "")).toThrow();
|
|
48
48
|
expect(() => generateToken(8, "x".repeat(257))).toThrow();
|
|
49
49
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { describe, expect,
|
|
1
|
+
import { describe, expect, it } from "bun:test";
|
|
2
2
|
import type { BridgeContext } from "../context";
|
|
3
3
|
import { protonCommand, protonCompatPath } from "./protonCommand";
|
|
4
4
|
|
|
@@ -13,13 +13,13 @@ const context = {
|
|
|
13
13
|
} as unknown as BridgeContext;
|
|
14
14
|
|
|
15
15
|
describe("protonCompatPath", () => {
|
|
16
|
-
|
|
16
|
+
it("gives every app its own compat data directory", () => {
|
|
17
17
|
expect(protonCompatPath("2430930")).toBe(".proton/2430930");
|
|
18
18
|
});
|
|
19
19
|
});
|
|
20
20
|
|
|
21
21
|
describe("protonCommand", () => {
|
|
22
|
-
|
|
22
|
+
it("builds an env prefix pointing inside the container home", async () => {
|
|
23
23
|
expect(
|
|
24
24
|
await protonCommand(context, {
|
|
25
25
|
appId: "2430930",
|
|
@@ -41,7 +41,7 @@ describe("protonCommand", () => {
|
|
|
41
41
|
]);
|
|
42
42
|
});
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
it("ensures the compat and steam directories", async () => {
|
|
45
45
|
ensured.length = 0;
|
|
46
46
|
|
|
47
47
|
await protonCommand(context, {
|
|
@@ -55,7 +55,7 @@ describe("protonCommand", () => {
|
|
|
55
55
|
]);
|
|
56
56
|
});
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
it("honours another proton build", async () => {
|
|
59
59
|
expect(
|
|
60
60
|
await protonCommand(context, {
|
|
61
61
|
appId: "1",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { describe, expect,
|
|
1
|
+
import { describe, expect, it } from "bun:test";
|
|
2
2
|
import type { BridgeContext } from "../context";
|
|
3
3
|
import { wineCommand, wineDllOverrides } from "./wineCommand";
|
|
4
4
|
|
|
@@ -13,7 +13,7 @@ const context = {
|
|
|
13
13
|
} as unknown as BridgeContext;
|
|
14
14
|
|
|
15
15
|
describe("wineDllOverrides", () => {
|
|
16
|
-
|
|
16
|
+
it("joins the overrides the way wine reads them", () => {
|
|
17
17
|
expect(
|
|
18
18
|
wineDllOverrides({
|
|
19
19
|
winhttp: "n,b",
|
|
@@ -24,7 +24,7 @@ describe("wineDllOverrides", () => {
|
|
|
24
24
|
});
|
|
25
25
|
|
|
26
26
|
describe("wineCommand", () => {
|
|
27
|
-
|
|
27
|
+
it("builds an env prefix pointing inside the container home", async () => {
|
|
28
28
|
expect(
|
|
29
29
|
await wineCommand(context, {
|
|
30
30
|
exe: "VRisingServer.exe",
|
|
@@ -45,7 +45,7 @@ describe("wineCommand", () => {
|
|
|
45
45
|
]);
|
|
46
46
|
});
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
it("ensures the prefix directory it points at", async () => {
|
|
49
49
|
ensured.length = 0;
|
|
50
50
|
|
|
51
51
|
await wineCommand(context, {
|
|
@@ -58,7 +58,7 @@ describe("wineCommand", () => {
|
|
|
58
58
|
]);
|
|
59
59
|
});
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
it("wraps the game in xvfb-run when asked", async () => {
|
|
62
62
|
const argv = await wineCommand(context, {
|
|
63
63
|
exe: "a.exe",
|
|
64
64
|
xvfb: true,
|
|
@@ -72,7 +72,7 @@ describe("wineCommand", () => {
|
|
|
72
72
|
]);
|
|
73
73
|
});
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
it("adds the dll overrides and extra environment", async () => {
|
|
76
76
|
const argv = await wineCommand(context, {
|
|
77
77
|
exe: "a.exe",
|
|
78
78
|
dllOverrides: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { describe, expect,
|
|
1
|
+
import { describe, expect, it } from "bun:test";
|
|
2
2
|
import type { BridgeContext, BridgeExecOptions } from "../context";
|
|
3
3
|
import { prepareWinePrefix, WINE_PREFIX_STAMP } from "./winePrefix";
|
|
4
4
|
|
|
@@ -45,7 +45,7 @@ const testContext = (code = 0) => {
|
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
describe("prepareWinePrefix", () => {
|
|
48
|
-
|
|
48
|
+
it("boots a wine prefix once and stamps it", async () => {
|
|
49
49
|
const { context, runs, stored } = testContext();
|
|
50
50
|
|
|
51
51
|
await prepareWinePrefix(context);
|
|
@@ -63,7 +63,7 @@ describe("prepareWinePrefix", () => {
|
|
|
63
63
|
expect(runs).toHaveLength(1);
|
|
64
64
|
});
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
it("boots the prefix through proton when asked", async () => {
|
|
67
67
|
const { context, runs } = testContext();
|
|
68
68
|
|
|
69
69
|
await prepareWinePrefix(context, {
|
|
@@ -79,7 +79,7 @@ describe("prepareWinePrefix", () => {
|
|
|
79
79
|
]);
|
|
80
80
|
});
|
|
81
81
|
|
|
82
|
-
|
|
82
|
+
it("boots again when the runtime changed from wine to proton", async () => {
|
|
83
83
|
const { context, runs } = testContext();
|
|
84
84
|
|
|
85
85
|
await prepareWinePrefix(context);
|
|
@@ -91,7 +91,7 @@ describe("prepareWinePrefix", () => {
|
|
|
91
91
|
expect(runs).toHaveLength(2);
|
|
92
92
|
});
|
|
93
93
|
|
|
94
|
-
|
|
94
|
+
it("refuses a proton prefix with no app id", async () => {
|
|
95
95
|
const { context } = testContext();
|
|
96
96
|
|
|
97
97
|
await expect(
|
|
@@ -101,7 +101,7 @@ describe("prepareWinePrefix", () => {
|
|
|
101
101
|
).rejects.toThrow("steam app id");
|
|
102
102
|
});
|
|
103
103
|
|
|
104
|
-
|
|
104
|
+
it("raises when wineboot fails and leaves no stamp", async () => {
|
|
105
105
|
const { context, stored } = testContext(1);
|
|
106
106
|
|
|
107
107
|
await expect(prepareWinePrefix(context)).rejects.toThrow("wineboot exploded");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { describe, expect,
|
|
1
|
+
import { describe, expect, it } from "bun:test";
|
|
2
2
|
import { BRIDGE_ACTIVITY_DETAILS_LIMIT, BRIDGE_ACTIVITY_LIMIT, BridgeEventName } from "@serverkgg/bridge/protocol";
|
|
3
3
|
import { bridgeActivitiesSchema, bridgeActivitySchema } from "./activity";
|
|
4
4
|
|
|
@@ -16,11 +16,11 @@ const entry = {
|
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
describe("bridgeActivitySchema", () => {
|
|
19
|
-
|
|
19
|
+
it("accepts a well-formed entry", () => {
|
|
20
20
|
expect(bridgeActivitySchema.parse(entry)).toEqual(entry);
|
|
21
21
|
});
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
it("accepts a name this reader does not know yet, so a newer game still reaches it", () => {
|
|
24
24
|
expect(
|
|
25
25
|
bridgeActivitySchema.safeParse({
|
|
26
26
|
...entry,
|
|
@@ -29,7 +29,7 @@ describe("bridgeActivitySchema", () => {
|
|
|
29
29
|
).toBe(true);
|
|
30
30
|
});
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
it("refuses a name that is not an event name", () => {
|
|
33
33
|
expect(
|
|
34
34
|
bridgeActivitySchema.safeParse({
|
|
35
35
|
...entry,
|
|
@@ -38,7 +38,7 @@ describe("bridgeActivitySchema", () => {
|
|
|
38
38
|
).toBe(false);
|
|
39
39
|
});
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
it("refuses an entry missing one language", () => {
|
|
42
42
|
expect(
|
|
43
43
|
bridgeActivitySchema.safeParse({
|
|
44
44
|
...entry,
|
|
@@ -50,7 +50,7 @@ describe("bridgeActivitySchema", () => {
|
|
|
50
50
|
).toBe(false);
|
|
51
51
|
});
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
it("refuses more details than an entry carries", () => {
|
|
54
54
|
const details: Record<string, number> = {};
|
|
55
55
|
|
|
56
56
|
for (let index = 0; index <= BRIDGE_ACTIVITY_DETAILS_LIMIT; index++) {
|
|
@@ -65,7 +65,7 @@ describe("bridgeActivitySchema", () => {
|
|
|
65
65
|
).toBe(false);
|
|
66
66
|
});
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
it("refuses a detail that is not a scalar", () => {
|
|
69
69
|
expect(
|
|
70
70
|
bridgeActivitySchema.safeParse({
|
|
71
71
|
...entry,
|
|
@@ -80,7 +80,7 @@ describe("bridgeActivitySchema", () => {
|
|
|
80
80
|
});
|
|
81
81
|
|
|
82
82
|
describe("bridgeActivitiesSchema", () => {
|
|
83
|
-
|
|
83
|
+
it("refuses more entries than one answer carries", () => {
|
|
84
84
|
expect(
|
|
85
85
|
bridgeActivitiesSchema.safeParse(
|
|
86
86
|
Array.from(
|