33 lines
1.2 KiB
TypeScript
33 lines
1.2 KiB
TypeScript
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
import { readFile } from "node:fs/promises";
|
|
|
|
async function readSource(path: string) {
|
|
return readFile(new URL(path, import.meta.url), "utf8");
|
|
}
|
|
|
|
test("ProjectDetailActivity keeps a rendered project snapshot for append-only realtime message patches", async () => {
|
|
const source = await readSource("../android/app/src/main/java/com/hyzq/boss/ProjectDetailActivity.java");
|
|
|
|
assert.match(
|
|
source,
|
|
/private @Nullable JSONObject currentRenderedProjectPayload;/,
|
|
"expected chat page to keep the latest rendered project payload for incremental realtime diffs",
|
|
);
|
|
assert.match(
|
|
source,
|
|
/if \(tryAppendRealtimeMessagesPatch\(projectMessagesPayload\)\) \{\s*return true;\s*\}/,
|
|
"expected chat page to try an append-only realtime patch before falling back to a full message rerender",
|
|
);
|
|
assert.match(
|
|
source,
|
|
/private boolean tryAppendRealtimeMessagesPatch\(JSONObject projectMessagesPayload\)/,
|
|
"expected chat page to expose a dedicated append-only realtime patch helper",
|
|
);
|
|
assert.match(
|
|
source,
|
|
/appendContent\(buildMessageView\(message\)\);/,
|
|
"expected append-only realtime patches to add only the new message views",
|
|
);
|
|
});
|