initial commit
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
import { WHEEL_COST } from "../dist/wheel.js";
|
||||
import { normalizeCoreMessage } from "../dist/live.js";
|
||||
test("wheel cost is 150", () => assert.equal(WHEEL_COST, 150));
|
||||
test("Bilibili gift messages normalize to typed inputs", () => {
|
||||
const event = normalizeCoreMessage({ cmd: "SEND_GIFT", data: { uid: 4, uname: "测试", giftName: "辣条", price: 150, num: 2, tid: "gift-1" } });
|
||||
assert.deepEqual(event, { kind: "gift", viewer: { uid: "4", name: "测试" }, giftName: "辣条", battery: 150, quantity: 2, sourceEventId: "gift-1" });
|
||||
});
|
||||
test("Bilibili danmaku commands with a suffix normalize from their raw packet", () => {
|
||||
const event = normalizeCoreMessage({ cmd: "DANMU_MSG:4:0", info: [[], "转盘 流行", [42, "观众"]] });
|
||||
assert.deepEqual(event, { kind: "danmaku", viewer: { uid: "42", name: "观众" }, text: "转盘 流行" });
|
||||
});
|
||||
test("Bilibili enter packets normalize from their raw packet", () => {
|
||||
const event = normalizeCoreMessage({ cmd: "INTERACT_WORD", data: { uid: 7, uname: "进房观众" } });
|
||||
assert.deepEqual(event, { kind: "enter", viewer: { uid: "7", name: "进房观众" } });
|
||||
});
|
||||
Reference in New Issue
Block a user