Files
boss/tests/android-folder-realtime-refresh.test.ts
2026-04-10 12:55:43 +08:00

27 lines
900 B
TypeScript

import test from "node:test";
import assert from "node:assert/strict";
import { readFile } from "node:fs/promises";
test("android folder activity refreshes on matching device-scoped conversation updates", async () => {
const source = await readFile(
new URL("../android/app/src/main/java/com/hyzq/boss/ConversationFolderActivity.java", import.meta.url),
"utf8",
);
assert.match(
source,
/private String folderDeviceId;/,
"expected folder activity to keep track of the folder device id for realtime filtering",
);
assert.match(
source,
/String payloadDeviceId = event\.payload\.optString\("deviceId", ""\)\.trim\(\);/,
"expected folder activity to inspect device-scoped realtime payloads",
);
assert.match(
source,
/payloadDeviceId\.equals\(folderDeviceId\)/,
"expected folder activity to reload when the event targets its device",
);
});