P10.2: convert remaining dashboardAPI tests from Mocha to node:test
P6.7 converted test/basic/. Convert test/edge/ and test/integration/ the same way: describe/it/expect → test/assert. No behavioural change. 5 / 5 tests pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,11 +1,11 @@
|
|||||||
|
const test = require('node:test');
|
||||||
|
const assert = require('node:assert/strict');
|
||||||
const fs = require('node:fs');
|
const fs = require('node:fs');
|
||||||
const path = require('node:path');
|
const path = require('node:path');
|
||||||
|
|
||||||
const flow = JSON.parse(fs.readFileSync(path.resolve(__dirname, '../../examples/basic.flow.json'), 'utf8'));
|
const flow = JSON.parse(fs.readFileSync(path.resolve(__dirname, '../../examples/basic.flow.json'), 'utf8'));
|
||||||
|
|
||||||
describe('dashboardAPI edge example structure', () => {
|
test('basic example includes node type dashboardapi', () => {
|
||||||
it('basic example includes node type dashboardapi', () => {
|
|
||||||
const count = flow.filter((n) => n && n.type === 'dashboardapi').length;
|
const count = flow.filter((n) => n && n.type === 'dashboardapi').length;
|
||||||
expect(count).toBeGreaterThanOrEqual(1);
|
assert.ok(count >= 1, `expected ≥1 dashboardapi node, got ${count}`);
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
const test = require('node:test');
|
||||||
|
const assert = require('node:assert/strict');
|
||||||
const fs = require('node:fs');
|
const fs = require('node:fs');
|
||||||
const path = require('node:path');
|
const path = require('node:path');
|
||||||
|
|
||||||
@@ -7,17 +9,15 @@ function loadJson(file) {
|
|||||||
return JSON.parse(fs.readFileSync(path.join(dir, file), 'utf8'));
|
return JSON.parse(fs.readFileSync(path.join(dir, file), 'utf8'));
|
||||||
}
|
}
|
||||||
|
|
||||||
describe('dashboardAPI integration examples', () => {
|
test('examples package exists for dashboardAPI', () => {
|
||||||
it('examples package exists for dashboardAPI', () => {
|
for (const file of ['README.md', 'basic.flow.json', 'integration.flow.json', 'edge.flow.json']) {
|
||||||
for (const file of ['README.md', 'basic.flow.json', 'integration.flow.json', 'edge.flow.json']) {
|
assert.ok(fs.existsSync(path.join(dir, file)), `missing ${file}`);
|
||||||
expect(fs.existsSync(path.join(dir, file))).toBe(true);
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
|
test('example flows are parseable arrays for dashboardAPI', () => {
|
||||||
it('example flows are parseable arrays for dashboardAPI', () => {
|
for (const file of ['basic.flow.json', 'integration.flow.json', 'edge.flow.json']) {
|
||||||
for (const file of ['basic.flow.json', 'integration.flow.json', 'edge.flow.json']) {
|
const parsed = loadJson(file);
|
||||||
const parsed = loadJson(file);
|
assert.ok(Array.isArray(parsed), `${file} is not an array`);
|
||||||
expect(Array.isArray(parsed)).toBe(true);
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user