Scope folder realtime refreshes by device
This commit is contained in:
26
tests/android-folder-realtime-refresh.test.ts
Normal file
26
tests/android-folder-realtime-refresh.test.ts
Normal 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",
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user