Skip to content

Commit f776160

Browse files
test(gateway): preserve scoped registry fixture
1 parent 48d564e commit f776160

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

‎src/gateway/test-helpers.plugin-registry.ts‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,21 @@ const pluginRegistryState = resolveGlobalSingleton(GATEWAY_TEST_PLUGIN_REGISTRY_
2828

2929
setActivePluginRegistry(pluginRegistryState.registry);
3030

31+
function replaceTestPluginRegistry(registry: PluginRegistry): void {
32+
// Gateway requests retain the startup registry object. Update that owned
33+
// snapshot in place so per-test fixtures exercise the same request scope.
34+
Object.assign(pluginRegistryState.registry, registry);
35+
setActivePluginRegistry(pluginRegistryState.registry);
36+
}
37+
3138
/** Installs a plugin registry fixture as the active runtime registry. */
3239
export function setTestPluginRegistry(registry: PluginRegistry): void {
33-
pluginRegistryState.registry = registry;
34-
setActivePluginRegistry(registry);
40+
replaceTestPluginRegistry(registry);
3541
}
3642

3743
/** Restores the default empty gateway test plugin registry. */
3844
export function resetTestPluginRegistry(): void {
39-
pluginRegistryState.registry = createStubPluginRegistry();
40-
setActivePluginRegistry(pluginRegistryState.registry);
45+
replaceTestPluginRegistry(createStubPluginRegistry());
4146
}
4247

4348
/** Returns the currently active gateway test plugin registry. */

0 commit comments

Comments
 (0)