Skip to content

Commit 9601049

Browse files
committed
Fix CI functional tests for async radio APIs
1 parent 61946e9 commit 9601049

1 file changed

Lines changed: 49 additions & 49 deletions

File tree

test/test_ci_functional.js

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -101,16 +101,16 @@ async function run() {
101101
assert(info.originalModel === 1, `model should be 1, got ${info.originalModel}`);
102102
});
103103

104-
await test('getConfigSchema works before open', () => {
105-
const schema = rig.getConfigSchema();
104+
await test('getConfigSchema works before open', async () => {
105+
const schema = await rig.getConfigSchema();
106106
assert(Array.isArray(schema), 'schema should be an array');
107107
assert(schema.length > 0, 'schema should not be empty');
108108
assert(typeof schema[0].name === 'string', 'schema item missing name');
109109
assert(schema.some((field) => field.name === 'rig_pathname'), 'schema should include rig_pathname');
110110
});
111111

112-
await test('getPortCaps works before open', () => {
113-
const caps = rig.getPortCaps();
112+
await test('getPortCaps works before open', async () => {
113+
const caps = await rig.getPortCaps();
114114
assert(caps && typeof caps === 'object', 'caps should be an object');
115115
assert(typeof caps.portType === 'string', 'caps.portType should be a string');
116116
assert(typeof caps.timeout === 'number', 'caps.timeout should be a number');
@@ -119,8 +119,8 @@ async function run() {
119119
await test('FlexRadio direct backend schema exposes network endpoint fields', async () => {
120120
const flexRig = new HamLib(2036);
121121
try {
122-
const schema = flexRig.getConfigSchema();
123-
const caps = flexRig.getPortCaps();
122+
const schema = await flexRig.getConfigSchema();
123+
const caps = await flexRig.getPortCaps();
124124
assert(schema.some((field) => field.name === 'rig_pathname'), 'Flex schema should include rig_pathname');
125125
assert(schema.some((field) => field.name === 'client'), 'Flex schema should include client');
126126
assert(caps.portType === 'network', `Flex port type should be network, got ${caps.portType}`);
@@ -132,7 +132,7 @@ async function run() {
132132
await test('IC-705 port caps expose serial defaults', async () => {
133133
const ic705 = new HamLib(3085);
134134
try {
135-
const caps = ic705.getPortCaps();
135+
const caps = await ic705.getPortCaps();
136136
assert(caps.portType === 'serial', `IC-705 port type should be serial, got ${caps.portType}`);
137137
assert(caps.serialRateMax === 19200, `IC-705 serialRateMax should be 19200, got ${caps.serialRateMax}`);
138138
assert(caps.serialDataBits === 8, `IC-705 serialDataBits should be 8, got ${caps.serialDataBits}`);
@@ -418,18 +418,18 @@ async function run() {
418418
// --- New API: Passband methods ---
419419
console.log('\n[Passband / Resolution]');
420420

421-
await test('getPassbandNormal returns number for USB', () => {
422-
const pb = rig.getPassbandNormal('USB');
421+
await test('getPassbandNormal returns number for USB', async () => {
422+
const pb = await rig.getPassbandNormal('USB');
423423
assert(typeof pb === 'number', `expected number, got ${typeof pb}`);
424424
});
425425

426-
await test('getPassbandNarrow returns number for USB', () => {
427-
const pb = rig.getPassbandNarrow('USB');
426+
await test('getPassbandNarrow returns number for USB', async () => {
427+
const pb = await rig.getPassbandNarrow('USB');
428428
assert(typeof pb === 'number', `expected number, got ${typeof pb}`);
429429
});
430430

431-
await test('getPassbandWide returns number for USB', () => {
432-
const pb = rig.getPassbandWide('USB');
431+
await test('getPassbandWide returns number for USB', async () => {
432+
const pb = await rig.getPassbandWide('USB');
433433
assert(typeof pb === 'number', `expected number, got ${typeof pb}`);
434434
});
435435

@@ -446,7 +446,7 @@ async function run() {
446446
});
447447

448448
await test('setMode accepts numeric passband width', async () => {
449-
await rig.setMode('USB', rig.getPassbandNormal('USB'));
449+
await rig.setMode('USB', await rig.getPassbandNormal('USB'));
450450
});
451451

452452
await test('getMode returns mode and numeric bandwidth', async () => {
@@ -455,26 +455,26 @@ async function run() {
455455
assert(typeof mode.bandwidth === 'number', `expected numeric bandwidth, got ${typeof mode.bandwidth}`);
456456
});
457457

458-
await test('getResolution returns number for USB', () => {
459-
const res = rig.getResolution('USB');
458+
await test('getResolution returns number for USB', async () => {
459+
const res = await rig.getResolution('USB');
460460
assert(typeof res === 'number', `expected number, got ${typeof res}`);
461461
});
462462

463463
// --- New API: Capability queries ---
464464
console.log('\n[Capability Queries]');
465465

466-
await test('getSupportedParms returns array', () => {
467-
const parms = rig.getSupportedParms();
466+
await test('getSupportedParms returns array', async () => {
467+
const parms = await rig.getSupportedParms();
468468
assert(Array.isArray(parms), `expected array, got ${typeof parms}`);
469469
});
470470

471-
await test('getSupportedVfoOps returns array', () => {
472-
const ops = rig.getSupportedVfoOps();
471+
await test('getSupportedVfoOps returns array', async () => {
472+
const ops = await rig.getSupportedVfoOps();
473473
assert(Array.isArray(ops), `expected array, got ${typeof ops}`);
474474
});
475475

476-
await test('getSupportedScanTypes returns array', () => {
477-
const types = rig.getSupportedScanTypes();
476+
await test('getSupportedScanTypes returns array', async () => {
477+
const types = await rig.getSupportedScanTypes();
478478
assert(Array.isArray(types), `expected array, got ${typeof types}`);
479479
});
480480

@@ -494,57 +494,57 @@ async function run() {
494494
// --- Capability Query Batch 2 ---
495495
console.log('\n[Capability Query - Batch 2]');
496496

497-
await test('getPreampValues returns number[]', () => {
498-
const vals = rig.getPreampValues();
497+
await test('getPreampValues returns number[]', async () => {
498+
const vals = await rig.getPreampValues();
499499
assert(Array.isArray(vals), `expected array, got ${typeof vals}`);
500500
vals.forEach((v, i) => assert(typeof v === 'number', `element ${i} not number`));
501501
});
502502

503-
await test('getAttenuatorValues returns number[]', () => {
504-
const vals = rig.getAttenuatorValues();
503+
await test('getAttenuatorValues returns number[]', async () => {
504+
const vals = await rig.getAttenuatorValues();
505505
assert(Array.isArray(vals), `expected array, got ${typeof vals}`);
506506
vals.forEach((v, i) => assert(typeof v === 'number', `element ${i} not number`));
507507
});
508508

509-
await test('getAgcLevels returns number[]', () => {
510-
const vals = rig.getAgcLevels();
509+
await test('getAgcLevels returns number[]', async () => {
510+
const vals = await rig.getAgcLevels();
511511
assert(Array.isArray(vals), `expected array, got ${typeof vals}`);
512512
vals.forEach((v, i) => assert(typeof v === 'number', `element ${i} not number`));
513513
});
514514

515-
await test('getMaxRit returns number >= 0', () => {
516-
const val = rig.getMaxRit();
515+
await test('getMaxRit returns number >= 0', async () => {
516+
const val = await rig.getMaxRit();
517517
assert(typeof val === 'number' && val >= 0, `expected number >= 0, got ${val}`);
518518
});
519519

520-
await test('getMaxXit returns number >= 0', () => {
521-
const val = rig.getMaxXit();
520+
await test('getMaxXit returns number >= 0', async () => {
521+
const val = await rig.getMaxXit();
522522
assert(typeof val === 'number' && val >= 0, `expected number >= 0, got ${val}`);
523523
});
524524

525-
await test('getMaxIfShift returns number >= 0', () => {
526-
const val = rig.getMaxIfShift();
525+
await test('getMaxIfShift returns number >= 0', async () => {
526+
const val = await rig.getMaxIfShift();
527527
assert(typeof val === 'number' && val >= 0, `expected number >= 0, got ${val}`);
528528
});
529529

530-
await test('getAvailableCtcssTones returns number[]', () => {
531-
const tones = rig.getAvailableCtcssTones();
530+
await test('getAvailableCtcssTones returns number[]', async () => {
531+
const tones = await rig.getAvailableCtcssTones();
532532
assert(Array.isArray(tones), `expected array, got ${typeof tones}`);
533533
if (tones.length > 0) {
534534
assert(tones[0] > 0, `first tone should be > 0, got ${tones[0]}`);
535535
}
536536
});
537537

538-
await test('getAvailableDcsCodes returns number[]', () => {
539-
const codes = rig.getAvailableDcsCodes();
538+
await test('getAvailableDcsCodes returns number[]', async () => {
539+
const codes = await rig.getAvailableDcsCodes();
540540
assert(Array.isArray(codes), `expected array, got ${typeof codes}`);
541541
if (codes.length > 0) {
542542
assert(codes[0] > 0, `first code should be > 0, got ${codes[0]}`);
543543
}
544544
});
545545

546-
await test('getFrequencyRanges returns {rx, tx}', () => {
547-
const ranges = rig.getFrequencyRanges();
546+
await test('getFrequencyRanges returns {rx, tx}', async () => {
547+
const ranges = await rig.getFrequencyRanges();
548548
assert(typeof ranges === 'object', `expected object, got ${typeof ranges}`);
549549
assert(Array.isArray(ranges.rx), `expected rx array, got ${typeof ranges.rx}`);
550550
assert(Array.isArray(ranges.tx), `expected tx array, got ${typeof ranges.tx}`);
@@ -556,8 +556,8 @@ async function run() {
556556
}
557557
});
558558

559-
await test('getTuningSteps returns TuningStepInfo[]', () => {
560-
const steps = rig.getTuningSteps();
559+
await test('getTuningSteps returns TuningStepInfo[]', async () => {
560+
const steps = await rig.getTuningSteps();
561561
assert(Array.isArray(steps), `expected array, got ${typeof steps}`);
562562
if (steps.length > 0) {
563563
const s = steps[0];
@@ -566,8 +566,8 @@ async function run() {
566566
}
567567
});
568568

569-
await test('getFilterList returns FilterInfo[]', () => {
570-
const filters = rig.getFilterList();
569+
await test('getFilterList returns FilterInfo[]', async () => {
570+
const filters = await rig.getFilterList();
571571
assert(Array.isArray(filters), `expected array, got ${typeof filters}`);
572572
if (filters.length > 0) {
573573
const f = filters[0];
@@ -576,8 +576,8 @@ async function run() {
576576
}
577577
});
578578

579-
await test('getLevelGranularity returns object or null', () => {
580-
const granularity = rig.getLevelGranularity('RFPOWER');
579+
await test('getLevelGranularity returns object or null', async () => {
580+
const granularity = await rig.getLevelGranularity('RFPOWER');
581581
if (granularity !== null) {
582582
assert(typeof granularity === 'object', `expected object, got ${typeof granularity}`);
583583
assert(typeof granularity.min === 'number', 'min should be number');
@@ -589,7 +589,7 @@ async function run() {
589589
});
590590

591591
await test('getRfPowerStepTable returns array or null', async () => {
592-
const table = rig.getRfPowerStepTable(7100000, 'USB');
592+
const table = await rig.getRfPowerStepTable(7100000, 'USB');
593593
if (table !== null) {
594594
let previousNormalized = -1;
595595
let previousMilliwatts = 0;
@@ -741,8 +741,8 @@ async function run() {
741741
await rig.destroy();
742742
});
743743

744-
await test('sync capability query after destroy throws instead of crashing', () => {
745-
assertThrows(() => rig.getSupportedModes(), /destroyed|initialized/);
744+
await test('async capability query after destroy rejects instead of crashing', async () => {
745+
await assertRejects(() => rig.getSupportedModes(), /destroyed|initialized/);
746746
});
747747

748748
await test('rotator close() succeeds', async () => {

0 commit comments

Comments
 (0)