feat(dashboard): align contracts and production build

This commit is contained in:
jjbrunton committed 2026-08-08 14:58:27 +01:00
1 parent 69d560d5c5
commit d6d29badcd
9 files changed
+189 -48

No files matched your search

+27
View File
@@ -0,0 +1,27 @@
import path from 'node:path';
import { describe, expect, it, vi } from 'vitest';
import { resolveDashboardAssets } from '../src/web/dashboard-assets.js';
describe('resolveDashboardAssets', () => {
it('selects the built React dashboard when its index exists', () => {
const workspace = path.resolve('workspace');
const reactIndex = path.join(workspace, 'apps', 'dashboard', 'dist', 'index.html');
const fileExists = vi.fn((candidate: string) => candidate === reactIndex);
expect(resolveDashboardAssets(workspace, fileExists)).toEqual({
directory: path.dirname(reactIndex),
indexFile: reactIndex,
isLegacy: false,
});
});
it('falls back to the legacy dashboard during incremental migration', () => {
const workspace = path.resolve('workspace');
expect(resolveDashboardAssets(workspace, () => false)).toEqual({
directory: path.join(workspace, 'public'),
indexFile: path.join(workspace, 'public', 'index.html'),
isLegacy: true,
});
});
});