Files

28 lines
1.3 KiB
JavaScript

import assert from 'node:assert/strict';
import { access, readFile } from 'node:fs/promises';
import test from 'node:test';
const requiredSourceModules = [
'../src/app/canvas_view.ts',
'../src/canvas/canvas.ts',
'../src/io/canvas_io.ts',
'../src/mask/mask_tool.ts',
'../src/media/image_utils.ts',
'../src/persistence/db.ts',
'../src/shared/types.ts',
];
test('frontend source layout keeps domain modules and a single registration bootstrap', async () => {
await Promise.all(requiredSourceModules.map((path) => access(new URL(path, import.meta.url))));
const bootstrapSource = await readFile(new URL('../src/canvas_view.ts', import.meta.url), 'utf8');
const implementationSource = await readFile(new URL('../src/app/canvas_view.ts', import.meta.url), 'utf8');
const canvasStateSource = await readFile(new URL('../src/canvas/canvas_state.ts', import.meta.url), 'utf8');
assert.match(bootstrapSource, /registerLayerForgeExtension\(\);/);
assert.match(implementationSource, /export function registerLayerForgeExtension\(\)/);
assert.match(implementationSource, /app\.registerExtension\(\{/);
assert.doesNotMatch(implementationSource, /^registerLayerForgeExtension\(\);/m);
assert.match(canvasStateSource, /new URL\('\.\.\/persistence\/state_saver\.worker\.js'/);
});