Files
deepseek-harness/packages/boot/app-boot/tests/profile-resolution-worker-bootstrap.spec.ts
T
imccyu 15e07d2721 refactor(boot): rename the profile resolution generation to the runtime resolution
RuntimeResolution, RuntimeResolutionEntry, RuntimeResolutionOptions, and createRuntimeResolution replace the generation-named table types; installRuntimeInterception returns a RuntimeInterception; PluginPackages takes { resolution }; Worker environment data carries { resolution }; routes are native, interception, and native-after-interception. replace() keeps its successor-generation wording.
2026-09-19 17:06:34 +08:00

43 lines
1.2 KiB
TypeScript

/** Worker bootstrap installs only the resolution inherited from its parent. */
import { beforeEach, expect, it, vi } from 'vitest'
import type { RuntimeResolution } from '../src/profile.ts'
const harness = vi.hoisted(() => ({
data: undefined as {
resolution: RuntimeResolution
} | undefined,
install: vi.fn(),
}))
vi.mock('node:worker_threads', () => ({
getEnvironmentData: () => harness.data,
}))
vi.mock('../src/profile-resolution/resolver.ts', () => ({
installRuntimeInterception: harness.install,
}))
beforeEach(() => {
harness.data = undefined
harness.install.mockReset()
vi.resetModules()
})
it('does nothing without inherited profile resolution data', async () => {
await import('../src/profile-resolution/worker-bootstrap.ts')
expect(harness.install).not.toHaveBeenCalled()
})
it('installs the inherited resolution', async () => {
const resolution: RuntimeResolution = {
profilesDir: '/profiles',
profileDir: '/profiles/test',
localPackageNames: [],
entries: [],
}
harness.data = { resolution }
await import('../src/profile-resolution/worker-bootstrap.ts')
expect(harness.install).toHaveBeenCalledWith(resolution)
})