test: dedupe plugin provider helper suites

This commit is contained in:
Peter Steinberger
2026-03-28 04:26:00 +00:00
parent 7e921050e3
commit 9155f3914a
10 changed files with 259 additions and 105 deletions

View File

@@ -31,6 +31,17 @@ describe("gateway request scope", () => {
expect(runtimeScope.getPluginRuntimeGatewayRequestScope()).toEqual(expected);
}
async function expectGatewayScopeWithPluginId(pluginId: string) {
await withTestGatewayScope(async (runtimeScope) => {
await runtimeScope.withPluginRuntimePluginIdScope(pluginId, async () => {
expectGatewayScope(runtimeScope, {
...TEST_SCOPE,
pluginId,
});
});
});
}
it("reuses AsyncLocalStorage across reloaded module instances", async () => {
const first = await importGatewayRequestScopeModule();
@@ -42,13 +53,6 @@ describe("gateway request scope", () => {
});
it("attaches plugin id to the active scope", async () => {
await withTestGatewayScope(async (runtimeScope) => {
await runtimeScope.withPluginRuntimePluginIdScope("voice-call", async () => {
expectGatewayScope(runtimeScope, {
...TEST_SCOPE,
pluginId: "voice-call",
});
});
});
await expectGatewayScopeWithPluginId("voice-call");
});
});