Files
RuView/harness/ruview/test/cli-numeric-input.test.mjs
T
ruv 3620abff12 fix(toolkit): integrate capture and device corrections for 0.9.2
Integrate reviewed source PRs #2201-#2223, #2225-#2231, #2235-#2240, #2242 and #2243 (firmware README hunks remain in #2247). Regenerate one package manifest after integration, validate native Windows test execution, bound MTK listener startup, support official C6 release bundles, and retain stronger release metadata gates.
2026-10-12 11:49:52 -04:00

25 lines
1023 B
JavaScript

import test from 'node:test';
import assert from 'node:assert/strict';
import { spawnSync } from 'node:child_process';
import { fileURLToPath } from 'node:url';
const cli = fileURLToPath(new URL('../bin/cli.js', import.meta.url));
function capture(args) {
// Invalid UDP port guarantees schema refusal before any socket is opened.
const child = spawnSync(process.execPath, [cli, 'esp32', '--udp-port', '1', ...args], { encoding: 'utf8' });
assert.equal(child.status, 1, child.stderr);
const result = JSON.parse(child.stdout);
assert.equal(result.reason, 'invalid_arguments');
return result.errors;
}
for (const args of [['--node-id'], ['--node-id=']]) {
test(`public CLI rejects absent numeric value ${args}`, () => {
assert.ok(capture(args).some((error) => error.includes('node_id')), 'missing node selector must not become 0 or 1');
});
}
test('public CLI still forwards explicit numeric node zero', () => {
assert.ok(!capture(['--node-id', '0']).some((error) => error.includes('node_id')));
});