mirror of
https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak.git
synced 2026-12-03 03:52:50 +08:00
feat: report live voice status and harden target handling
This commit is contained in:
1 parent
e0d5916a86
commit
0a4fff6f6f
19 files changed
+1003
-101
No files matched your search
@@ -0,0 +1,33 @@
|
||||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
import { parseClientCommand } from "./voice-protocol.js";
|
||||
|
||||
test("accepts a bounded audio stats snapshot request", () => {
|
||||
assert.deepEqual(parseClientCommand(JSON.stringify({
|
||||
type: "audioStatsProbe",
|
||||
payload: { sequence: "audio-sample-1" },
|
||||
})), {
|
||||
type: "audioStatsProbe",
|
||||
payload: { sequence: "audio-sample-1" },
|
||||
});
|
||||
});
|
||||
|
||||
test("continues accepting the legacy control-path probe for cached clients", () => {
|
||||
assert.deepEqual(parseClientCommand(JSON.stringify({
|
||||
type: "latencyProbe",
|
||||
payload: { sequence: "latency-old-client" },
|
||||
})), {
|
||||
type: "latencyProbe",
|
||||
payload: { sequence: "latency-old-client" },
|
||||
});
|
||||
});
|
||||
|
||||
test("rejects audio stats requests without a short sequence id", () => {
|
||||
const result = parseClientCommand(JSON.stringify({
|
||||
type: "audioStatsProbe",
|
||||
payload: { sequence: "x".repeat(65) },
|
||||
}));
|
||||
assert.deepEqual(result, {
|
||||
error: { code: "INVALID_AUDIO_STATS_PROBE", message: "音频状态采样标识无效" },
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user