MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / makeFixture

Function makeFixture

packages/server/test/snapshotService.unit.test.ts:125–154  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

123const tmpDirs: string[] = [];
124
125async function makeFixture(): Promise<Fixture> {
126 const homeDir = await mkdtemp(join(tmpdir(), 'kimi-snapshot-unit-'));
127 const workDir = await mkdtemp(join(tmpdir(), 'kimi-snapshot-workdir-'));
128 tmpDirs.push(homeDir, workDir);
129
130 const store = new SessionStore(homeDir);
131 const bus = new EventService();
132 const broadcast = new StubBroadcast();
133 const approvals = new StubApprovals();
134 const questions = new StubQuestions();
135 const prompts = new StubPrompts();
136
137 const env = {
138 _serviceBrand: undefined as undefined,
139 homeDir,
140 configPath: join(homeDir, 'config.toml'),
141 };
142
143 const service = new SnapshotService(
144 env,
145 new NoopLog(),
146 bus,
147 broadcast as unknown as IWSBroadcastServiceT,
148 approvals as unknown as IApprovalService,
149 questions as unknown as IQuestionService,
150 prompts as unknown as IPromptService,
151 );
152
153 return { homeDir, workDir, store, bus, broadcast, approvals, questions, prompts, service };
154}
155
156async function writeWire(sessionDir: string, lines: ReadonlyArray<unknown>): Promise<void> {
157 const agentDir = join(sessionDir, 'agents', 'main');

Callers 1

Calls 2

mkdtempFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected