Skip to content

Commit cf5f794

Browse files
fix(discord): avoid __testing alias to satisfy Knip production scan
1 parent 686099f commit cf5f794

3 files changed

Lines changed: 10 additions & 3 deletions

File tree

‎extensions/discord/src/monitor/provider.lifecycle.test.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -742,10 +742,11 @@ describe("runDiscordGatewayLifecycle", () => {
742742
});
743743

744744
describe("waitForGatewayReady", () => {
745-
let waitForGatewayReady: typeof import("./provider.lifecycle.js").waitForGatewayReady;
745+
let waitForGatewayReady: (typeof import("../../test-api.js"))["discordGatewayLifecycleTesting"]["waitForGatewayReady"];
746746

747747
beforeAll(async () => {
748-
({ waitForGatewayReady } = await import("./provider.lifecycle.js"));
748+
waitForGatewayReady = (await import("../../test-api.js")).discordGatewayLifecycleTesting
749+
.waitForGatewayReady;
749750
});
750751

751752
it("returns promptly when abortSignal fires during the READY retry backoff", async () => {
@@ -759,6 +760,7 @@ describe("waitForGatewayReady", () => {
759760
isConnected: false,
760761
connect: vi.fn(),
761762
disconnect: vi.fn(),
763+
ws: null,
762764
};
763765
const runtime: RuntimeEnv = {
764766
log: () => {},

‎extensions/discord/src/monitor/provider.lifecycle.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ function createGatewayStatusObserver(params: {
324324
};
325325
}
326326

327-
export async function waitForGatewayReady(params: {
327+
async function waitForGatewayReady(params: {
328328
gateway?: Pick<MutableDiscordGateway, "connect" | "disconnect" | "isConnected" | "ws">;
329329
abortSignal?: AbortSignal;
330330
beforePoll?: () => Promise<"continue" | "stop"> | "continue" | "stop";
@@ -585,3 +585,7 @@ export async function runDiscordGatewayLifecycle(params: {
585585
params.threadBindings.stop();
586586
}
587587
}
588+
589+
// Test-only surface. Re-exported from the plugin root `test-api.ts` entry so Knip's
590+
// production scan sees the consumer; tests import `testing` from `test-api.js`.
591+
export const testing = { waitForGatewayReady };

‎extensions/discord/test-api.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Discord API module exposes the plugin public contract.
22
export { discordPlugin } from "./src/channel.js";
33
export { buildFinalizedDiscordDirectInboundContext } from "./src/monitor/inbound-context.test-helpers.js";
4+
export { testing as discordGatewayLifecycleTesting } from "./src/monitor/provider.lifecycle.js";
45
export { testing as discordThreadBindingTesting } from "./src/monitor/thread-bindings.manager.js";
56
export { discordOutbound } from "./src/outbound-adapter.js";

0 commit comments

Comments
 (0)