Phase5
This commit is contained in:
42
apps/api/test/phase5.test.js
Normal file
42
apps/api/test/phase5.test.js
Normal file
@@ -0,0 +1,42 @@
|
||||
import { describe, it } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { join } from 'node:path';
|
||||
|
||||
describe('phase 5 api contract', () => {
|
||||
it('documents catalog and add-ons routes', () => {
|
||||
const files = [
|
||||
'catalog/catalog.controller.ts',
|
||||
'servers/addons/addons.controller.ts',
|
||||
'servers/addons/addons.service.ts',
|
||||
];
|
||||
|
||||
for (const file of files) {
|
||||
const source = readFileSync(join(process.cwd(), 'src', file), 'utf8');
|
||||
assert.ok(source.length > 0, `${file} should exist`);
|
||||
}
|
||||
|
||||
const catalogSource = readFileSync(
|
||||
join(process.cwd(), 'src', 'catalog/catalog.controller.ts'),
|
||||
'utf8',
|
||||
);
|
||||
assert.ok(catalogSource.includes("@Get('projects')"));
|
||||
assert.ok(catalogSource.includes('projects/:projectId/versions'));
|
||||
|
||||
const addonsSource = readFileSync(
|
||||
join(process.cwd(), 'src', 'servers/addons/addons.controller.ts'),
|
||||
'utf8',
|
||||
);
|
||||
assert.ok(addonsSource.includes('servers/:serverId/addons'));
|
||||
assert.ok(addonsSource.includes('@Post()'));
|
||||
assert.ok(addonsSource.includes("@Delete(':addonId')"));
|
||||
|
||||
const serviceSource = readFileSync(
|
||||
join(process.cwd(), 'src', 'servers/addons/addons.service.ts'),
|
||||
'utf8',
|
||||
);
|
||||
assert.ok(serviceSource.includes('installAddon'));
|
||||
assert.ok(serviceSource.includes('removeAddon'));
|
||||
assert.ok(serviceSource.includes('AddonListResponse'));
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user