refactor: replace feature globals with typed services
This commit is contained in:
+2
-1
@@ -38,9 +38,10 @@ test("background decode loads configuration for the explicitly selected rig", as
|
||||
const source = await readFile(new URL("../../assets/web/generated/background-decode.js", import.meta.url), "utf8");
|
||||
new vm.Script(source).runInContext(context);
|
||||
|
||||
window.initBackgroundDecode("rig/a", "control");
|
||||
window.trx.modules.backgroundDecode.initialize("rig/a", "control");
|
||||
await new Promise((resolve) => setTimeout(resolve, 0));
|
||||
assert.ok(requested.includes("/background-decode/rig%2Fa"));
|
||||
assert.ok(requested.includes("/bookmarks"));
|
||||
assert.ok(requested.includes("/background-decode/rig%2Fa/status"));
|
||||
assert.equal(window.initBackgroundDecode, undefined);
|
||||
});
|
||||
|
||||
@@ -69,5 +69,7 @@ test("bookmarks register an explicit typed service for application consumers", a
|
||||
assert.equal(window.trx.modules.bookmarks.overlayList.length, 1);
|
||||
assert.equal(window.trx.modules.bookmarks.overlayList[0].id, "one");
|
||||
assert.equal(typeof window.trx.modules.bookmarks.apply, "function");
|
||||
assert.equal(typeof window.trx.modules.bookmarks.formatFrequency, "function");
|
||||
assert.equal(typeof window.trx.modules.bookmarks.populateScopePicker, "function");
|
||||
assert.equal(globalThis.bmOverlayList, undefined);
|
||||
});
|
||||
|
||||
@@ -28,9 +28,12 @@ test("virtual channels expose typed SSE and interception boundaries", async () =
|
||||
const source = await readFile(new URL("../../assets/web/generated/vchan.js", import.meta.url), "utf8");
|
||||
new vm.Script(source).runInContext(context);
|
||||
|
||||
assert.equal(typeof window.vchanHandleSession, "function");
|
||||
assert.equal(typeof window.vchanHandleChannels, "function");
|
||||
assert.equal(typeof window.vchanApplyCapabilities, "function");
|
||||
assert.equal(await window.vchanInterceptMode("USB"), false);
|
||||
assert.equal(await window.vchanInterceptBandwidth(2400), false);
|
||||
const service = window.trx.modules.vchan;
|
||||
assert.equal(typeof service.handleSession, "function");
|
||||
assert.equal(typeof service.handleChannels, "function");
|
||||
assert.equal(typeof service.applyCapabilities, "function");
|
||||
assert.equal(await service.interceptMode("USB"), false);
|
||||
assert.equal(await service.interceptBandwidth(2400), false);
|
||||
assert.equal(window.vchanHandleSession, undefined);
|
||||
assert.equal(window.vchanInterceptBandwidth, undefined);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user