move some state to session
This commit is contained in:
+13
-1
@@ -3,9 +3,10 @@ import "../shim.ts";
|
||||
import assert from "assert";
|
||||
|
||||
import { XqBytesDec, XqBytesEnc } from "../func_replacements.js";
|
||||
import { createResponseForControlCommand } from "../handlers.js";
|
||||
import { hexdump } from "../hexdump.js";
|
||||
import { SendUsrChk } from "../impl.ts";
|
||||
import { placeholderTypes, sprintf } from "../utils.js";
|
||||
import { hexdump } from "../hexdump.js";
|
||||
|
||||
describe("debug_tools", () => {
|
||||
it("parses printed data", () => {
|
||||
@@ -122,4 +123,15 @@ describe("make packet", () => {
|
||||
const expected = hstrToBA(expected_str);
|
||||
assert.deepEqual(SendUsrChk("admin", "admin").buffer, expected);
|
||||
});
|
||||
it("builds a good SendStartVideo", () => {
|
||||
const input_pkt_str = "f1d00018d1000000110a20110c00ff000000000064504737fe010101";
|
||||
// token-in = 0x64 0x50 0x47 0x37
|
||||
const _expected_str = "f1d00114d1000000110a1030080100006551463601010101";
|
||||
// output is 0x3010; 'start video'; hardcoded but shouldnt
|
||||
const expected = hstrToBA(_expected_str);
|
||||
|
||||
const sess = { outgoingCommandId: 0 };
|
||||
const got = createResponseForControlCommand(sess, new DataView(hstrToBA(input_pkt_str)));
|
||||
assert.deepEqual(got.buffer, expected);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user