feat: Data and run
This commit is contained in:
@@ -6,6 +6,18 @@ describe('envSchema', () => {
|
||||
expect(r.success).toBe(true);
|
||||
});
|
||||
|
||||
it('defaults DATABASE_PATH to ./data/db.sqlite', () => {
|
||||
const r = envSchema.safeParse({});
|
||||
expect(r.success).toBe(true);
|
||||
expect((r.data as any).DATABASE_PATH).toBe('./data/db.sqlite');
|
||||
});
|
||||
|
||||
it('defaults UPLOAD_DIR to ./data/uploads', () => {
|
||||
const r = envSchema.safeParse({});
|
||||
expect(r.success).toBe(true);
|
||||
expect((r.data as any).UPLOAD_DIR).toBe('./data/uploads');
|
||||
});
|
||||
|
||||
it('rejects invalid PORT', () => {
|
||||
const r = envSchema.safeParse({ PORT: 'not-a-number' });
|
||||
expect(r.success).toBe(false);
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
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/);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user