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

Function makeDeps

apps/kimi-code/test/cli/vis.test.ts:14–45  ·  view source on GitHub ↗
(over: Partial<VisDeps> = {})

Source from the content-addressed store, hash-verified

12import { handleVis, type VisDeps } from '#/cli/sub/vis';
13
14function makeDeps(over: Partial<VisDeps> = {}): {
15 deps: VisDeps;
16 opened: string[];
17 out: string[];
18} {
19 const opened: string[] = [];
20 const out: string[] = [];
21 const deps: VisDeps = {
22 getHomeDir: () => '/home/k',
23 startVisServer: vi.fn(async (o) => ({
24 port: 41234,
25 host: '127.0.0.1',
26 url: 'http://127.0.0.1:41234/',
27 close: async () => {},
28 _opts: o,
29 })) as unknown as VisDeps['startVisServer'],
30 openUrl: async (u: string) => {
31 opened.push(u);
32 },
33 waitForShutdown: async () => {},
34 stdout: {
35 write: (s: string) => {
36 out.push(s);
37 return true;
38 },
39 },
40 stderr: { write: () => true },
41 exit: vi.fn() as unknown as VisDeps['exit'],
42 ...over,
43 };
44 return { deps, opened, out };
45}
46
47describe('handleVis', () => {
48 it('starts the server with the home dir + auto port and opens the browser', async () => {

Callers 1

vis.test.tsFile · 0.70

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected