Skip to content

Commit 2985fc0

Browse files
committed
test: add irc runtime api smoke coverage
1 parent 7572f17 commit 2985fc0

1 file changed

Lines changed: 55 additions & 0 deletions

File tree

extensions/irc/runtime-api.test.ts

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import { execFile } from "node:child_process";
2+
import path from "node:path";
3+
import { fileURLToPath } from "node:url";
4+
import { promisify } from "node:util";
5+
import { describe, expect, it } from "vitest";
6+
7+
const execFileAsync = promisify(execFile);
8+
const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..", "..");
9+
const ircImportEnv = {
10+
HOME: process.env.HOME,
11+
NODE_OPTIONS: process.env.NODE_OPTIONS,
12+
NODE_PATH: process.env.NODE_PATH,
13+
PATH: process.env.PATH,
14+
TERM: process.env.TERM,
15+
} satisfies NodeJS.ProcessEnv;
16+
17+
describe("irc bundled api seams", () => {
18+
it("loads the narrow channel plugin api in direct smoke", async () => {
19+
const { stdout } = await execFileAsync(
20+
process.execPath,
21+
[
22+
"--import",
23+
"tsx",
24+
"-e",
25+
'const mod = await import("./extensions/irc/channel-plugin-api.ts"); process.stdout.write(JSON.stringify({keys:Object.keys(mod).sort(), id: mod.ircPlugin.id}));',
26+
],
27+
{
28+
cwd: repoRoot,
29+
env: ircImportEnv,
30+
timeout: 40_000,
31+
},
32+
);
33+
34+
expect(stdout).toBe('{"keys":["ircPlugin"],"id":"irc"}');
35+
}, 45_000);
36+
37+
it("loads the narrow runtime api in direct smoke", async () => {
38+
const { stdout } = await execFileAsync(
39+
process.execPath,
40+
[
41+
"--import",
42+
"tsx",
43+
"-e",
44+
'const mod = await import("./extensions/irc/runtime-api.ts"); process.stdout.write(JSON.stringify({keys:Object.keys(mod).sort(), type: typeof mod.setIrcRuntime}));',
45+
],
46+
{
47+
cwd: repoRoot,
48+
env: ircImportEnv,
49+
timeout: 40_000,
50+
},
51+
);
52+
53+
expect(stdout).toBe('{"keys":["setIrcRuntime"],"type":"function"}');
54+
}, 45_000);
55+
});

0 commit comments

Comments
 (0)