Files
HIPCTF2/tests/backend/root-dev-script.spec.ts
T

27 lines
987 B
TypeScript

import { readFileSync } from 'node:fs';
import * as path from 'node:path';
describe('Root dev script orchestration', () => {
it('exposes a `dev` script that runs both backend and frontend workspaces', () => {
const pkg = JSON.parse(
readFileSync(path.join(__dirname, '..', '..', 'package.json'), 'utf8'),
);
expect(typeof pkg.scripts?.dev).toBe('string');
expect(pkg.scripts.dev).toMatch(/workspace\s+backend/);
expect(pkg.scripts.dev).toMatch(/workspace\s+frontend/);
});
it('configures the Angular dev server to proxy /api and /uploads to the Nest backend', () => {
const angularJson = JSON.parse(
readFileSync(
path.join(__dirname, '..', '..', 'frontend', 'angular.json'),
'utf8',
),
);
const serve = angularJson.projects?.hipctf?.architect?.serve;
expect(serve).toBeDefined();
expect(typeof serve.options?.proxyConfig).toBe('string');
expect(serve.options.proxyConfig).toMatch(/proxy/);
});
});