Scope folder realtime refreshes by device

This commit is contained in:
kris
2026-04-10 12:55:43 +08:00
parent d1e5a1ac5e
commit 0cba837ed3
11 changed files with 357 additions and 9 deletions

View File

@@ -0,0 +1,26 @@
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",
);
});