20 lines
729 B
TypeScript
20 lines
729 B
TypeScript
import { readFile } from 'node:fs/promises';
|
|
import { resolve } from 'node:path';
|
|
import { describe, expect, it } from 'vitest';
|
|
|
|
describe('AI hardware Host API registration', () => {
|
|
it('registers the dedicated handler in the Host API route chain', async () => {
|
|
const source = await readFile(resolve('electron/api/server.ts'), 'utf8');
|
|
|
|
expect(source).toMatch(
|
|
/import\s+\{\s*handleAiHardwareRoutes\s*\}\s+from\s+['"]\.\/routes\/ai-hardware['"]/,
|
|
);
|
|
|
|
const routeList = source.match(
|
|
/const\s+coreRouteHandlers\s*:\s*RouteHandler\[\]\s*=\s*\[([\s\S]*?)\];/,
|
|
);
|
|
expect(routeList?.[1]).toBeDefined();
|
|
expect(routeList?.[1].match(/\bhandleAiHardwareRoutes\b/g)).toHaveLength(1);
|
|
});
|
|
});
|