MCPcopy Create free account
hub / github.com/Kilo-Org/cloud / buildAdapter

Function buildAdapter

apps/web/src/lib/bot/platforms/linear.test.ts:348–373  ·  view source on GitHub ↗
(
    overrides: {
      installation?: LinearInstallation | null;
      decodeThreadId?: (id: string) => { issueId: string };
    } = {}
  )

Source from the content-addressed store, hash-verified

346 };
347
348 function buildAdapter(
349 overrides: {
350 installation?: LinearInstallation | null;
351 decodeThreadId?: (id: string) => { issueId: string };
352 } = {}
353 ): AdapterHarness {
354 const installation =
355 overrides.installation === undefined ? defaultInstallation : overrides.installation;
356 const getInstallation = jest.fn(async () => installation);
357 const decodeThreadId = jest.fn(
358 overrides.decodeThreadId ?? ((id: string) => ({ issueId: id.replace(/^linear:/, '') }))
359 );
360 const withInstallation = jest.fn(async <T>(_id: unknown, fn: () => Promise<T> | T) => fn());
361
362 return {
363 getInstallation,
364 decodeThreadId,
365 withInstallation,
366 adapter: {
367 name: 'linear',
368 getInstallation,
369 decodeThreadId,
370 withInstallation,
371 } as unknown as LinearAdapter,
372 };
373 }
374
375 beforeEach(() => {
376 jest.clearAllMocks();

Callers 1

linear.test.tsFile · 0.85

Calls 1

replaceMethod · 0.65

Tested by

no test coverage detected