mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-09-30 12:39:42 +02:00
32 lines
983 B
TypeScript
32 lines
983 B
TypeScript
import { execFileSync } from 'node:child_process';
|
|
import { readFileSync } from 'node:fs';
|
|
import { resolve } from 'node:path';
|
|
import { describe, expect, it } from 'vitest';
|
|
|
|
const repoRoot = resolve(import.meta.dirname, '..');
|
|
|
|
describe('frontend public asset tooling', () => {
|
|
it('exposes a public asset check script', () => {
|
|
const pkg = JSON.parse(readFileSync(resolve(repoRoot, 'package.json'), 'utf8')) as {
|
|
scripts?: Record<string, string>;
|
|
};
|
|
|
|
expect(pkg.scripts?.['check:public-assets']).toContain('scripts/check-public-assets.mjs');
|
|
});
|
|
|
|
it('keeps app.js free of literal NUL bytes', () => {
|
|
const appJs = readFileSync(resolve(repoRoot, 'src/web/public/app.js'));
|
|
|
|
expect(appJs.includes(0)).toBe(false);
|
|
});
|
|
|
|
it('runs the public asset check script', () => {
|
|
expect(() => {
|
|
execFileSync('npm', ['run', 'check:public-assets', '--silent'], {
|
|
cwd: repoRoot,
|
|
stdio: 'pipe',
|
|
});
|
|
}).not.toThrow();
|
|
});
|
|
});
|