Refresh project chat page on conversation updates
This commit is contained in:
@@ -44,7 +44,13 @@ export default async function ProjectChatPage({
|
||||
return (
|
||||
<AppShell bottomNav={false}>
|
||||
<RealtimeRefresh
|
||||
events={["project.messages.updated", "app.logs.updated", "project.context_risk.updated", "ota.updated"]}
|
||||
events={[
|
||||
"conversation.updated",
|
||||
"project.messages.updated",
|
||||
"app.logs.updated",
|
||||
"project.context_risk.updated",
|
||||
"ota.updated",
|
||||
]}
|
||||
/>
|
||||
<StatusBar />
|
||||
<PageNav
|
||||
|
||||
20
tests/project-chat-page-realtime-events.test.ts
Normal file
20
tests/project-chat-page-realtime-events.test.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import test from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import path from "node:path";
|
||||
import { readFile } from "node:fs/promises";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const testsDir = path.dirname(fileURLToPath(import.meta.url));
|
||||
const projectChatPagePath = path.join(testsDir, "../src/app/conversations/[projectId]/page.tsx");
|
||||
|
||||
test("project chat page listens to conversation updates for realtime refresh", async () => {
|
||||
const source = await readFile(projectChatPagePath, "utf8");
|
||||
const realtimeRefreshConfig = source.match(/<RealtimeRefresh[\s\S]*?events=\{\[([\s\S]*?)\]\}/);
|
||||
|
||||
assert.ok(realtimeRefreshConfig, "expected project chat page to declare RealtimeRefresh events");
|
||||
assert.match(
|
||||
realtimeRefreshConfig[1],
|
||||
/"conversation\.updated"/,
|
||||
"expected project chat page to refresh when conversation.updated is emitted",
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user