refactor: add typed decoder plugin runtime
This commit is contained in:
@@ -23,10 +23,13 @@ test("AIS entry forwards positioned vessels with normalized metadata", async ()
|
||||
Map,
|
||||
console,
|
||||
});
|
||||
const runtime = await readFile(new URL("../../assets/web/generated/plugin-runtime.js", import.meta.url), "utf8");
|
||||
const source = await readFile(new URL("../../assets/web/generated/ais.js", import.meta.url), "utf8");
|
||||
new vm.Script(runtime).runInContext(context);
|
||||
new vm.Script(source).runInContext(context);
|
||||
|
||||
window.onServerAis({ mmsi: 261000001, lat: 54.5, lon: 18.5, channel: "A", ts_ms: Date.now() });
|
||||
window.trxPluginRuntime.dispatch("ais", { mmsi: 261000001, lat: 54.5, lon: 18.5, channel: "A", ts_ms: Date.now() });
|
||||
assert.equal(window.onServerAis, undefined);
|
||||
assert.equal(forwarded.length, 1);
|
||||
assert.equal(forwarded[0].mmsi, 261000001);
|
||||
assert.equal(forwarded[0].rig_id, null);
|
||||
|
||||
Reference in New Issue
Block a user