Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

743 B
Raw Blame
import { PluginRpcRegistry } from './registry';
import type { PluginRpcRegistryOptions } from './types';

/**
 * Builds a registry from hand-constructed `@PluginController()` instances, with no
 * Nest app required. This is why the metadata store is a WeakMap rather than
 * reflect-metadata: a bare vitest worker can assemble the same registry the
 * container would.
 */
export function createTestPluginRegistry(
  instances: readonly object[],
  options: PluginRpcRegistryOptions = {},
): PluginRpcRegistry {
  const registry = new PluginRpcRegistry(options);
  for (const instance of instances) registry.register(instance);
  // Same fail-fast contract as PluginRpcRegistryService.onModuleInit.
  registry.validate();
  return registry;
}