42 lines
1.3 KiB
JavaScript
42 lines
1.3 KiB
JavaScript
import { describe, it } from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { readFileSync } from 'node:fs';
|
|
import { join } from 'node:path';
|
|
|
|
describe('phase 6 api contract', () => {
|
|
it('documents scheduler, queue and admin node routes', () => {
|
|
const files = [
|
|
'scheduling/scheduling.service.ts',
|
|
'admin/admin-nodes.controller.ts',
|
|
'admin/admin-nodes.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 adminSource = readFileSync(
|
|
join(process.cwd(), 'src', 'admin/admin-nodes.controller.ts'),
|
|
'utf8',
|
|
);
|
|
assert.ok(adminSource.includes("@Get()"));
|
|
assert.ok(adminSource.includes(':id/drain'));
|
|
assert.ok(adminSource.includes(':id/maintenance'));
|
|
|
|
const schedulingSource = readFileSync(
|
|
join(process.cwd(), 'src', 'scheduling/scheduling.service.ts'),
|
|
'utf8',
|
|
);
|
|
assert.ok(schedulingSource.includes('enqueueStart'));
|
|
assert.ok(schedulingSource.includes('getQueuePosition'));
|
|
|
|
const serversSource = readFileSync(
|
|
join(process.cwd(), 'src', 'servers/servers.controller.ts'),
|
|
'utf8',
|
|
);
|
|
assert.ok(serversSource.includes('start-queue'));
|
|
assert.ok(serversSource.includes('cancel-queue'));
|
|
});
|
|
});
|