37 lines
1.2 KiB
TypeScript
37 lines
1.2 KiB
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",
|
|
);
|
|
assert.match(
|
|
source,
|
|
/tryApplyFolderRealtimePatch\(event\)/,
|
|
"expected folder activity to try a local thread-row patch before falling back to network reload",
|
|
);
|
|
assert.match(
|
|
source,
|
|
/threadConversationItem/,
|
|
"expected folder activity to read the direct thread item patch from realtime payloads",
|
|
);
|
|
});
|