fix(webui): restore full-project typechecking
This commit is contained in:
1 parent
f869212e7d
commit
a1bca7dc50
56 files changed
+622
-583
No files matched your search
@@ -10,6 +10,7 @@ import type {
|
||||
ConnectionStatus,
|
||||
GoalStateWsPayload,
|
||||
InboundEvent,
|
||||
UIMediaAttachment,
|
||||
UIMessage,
|
||||
} from "@/lib/types";
|
||||
import { ClientProvider } from "@/providers/ClientProvider";
|
||||
@@ -418,7 +419,7 @@ describe("useNanobotStream", () => {
|
||||
requestFrame.mockRestore();
|
||||
now.mockRestore();
|
||||
if (descriptor) Object.defineProperty(document, "visibilityState", descriptor);
|
||||
else delete (document as Document & { visibilityState?: string }).visibilityState;
|
||||
else Reflect.deleteProperty(document, "visibilityState");
|
||||
vi.useRealTimers();
|
||||
}
|
||||
});
|
||||
@@ -466,7 +467,7 @@ describe("useNanobotStream", () => {
|
||||
if (visibilityDescriptor) {
|
||||
Object.defineProperty(document, "visibilityState", visibilityDescriptor);
|
||||
} else {
|
||||
delete (document as Document & { visibilityState?: DocumentVisibilityState }).visibilityState;
|
||||
Reflect.deleteProperty(document, "visibilityState");
|
||||
}
|
||||
vi.useRealTimers();
|
||||
}
|
||||
@@ -2340,23 +2341,23 @@ describe("useNanobotStream", () => {
|
||||
{ wrapper: wrap(fake.client) },
|
||||
);
|
||||
|
||||
let submitted: ReturnType<typeof result.current.send> = null;
|
||||
const submitted: { current: ReturnType<typeof result.current.send> } = { current: null };
|
||||
act(() => {
|
||||
submitted = result.current.send("bind the camera");
|
||||
submitted.current = result.current.send("bind the camera");
|
||||
});
|
||||
|
||||
expect(submitted).not.toBeNull();
|
||||
expect(submitted?.sideChannel).toBe(false);
|
||||
expect(submitted.current).not.toBeNull();
|
||||
expect(submitted.current?.sideChannel).toBe(false);
|
||||
expect(result.current.messages[0]).toMatchObject({
|
||||
id: submitted?.userMessageId,
|
||||
turnId: submitted?.turnId,
|
||||
id: submitted.current?.userMessageId,
|
||||
turnId: submitted.current?.turnId,
|
||||
role: "user",
|
||||
});
|
||||
expect(fake.client.sendMessage).toHaveBeenCalledWith(
|
||||
"chat-submitted-turn",
|
||||
"bind the camera",
|
||||
undefined,
|
||||
expect.objectContaining({ turnId: submitted?.turnId }),
|
||||
expect.objectContaining({ turnId: submitted.current?.turnId }),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -2840,12 +2841,16 @@ describe("useNanobotStream", () => {
|
||||
wrapper: wrap(fake.client),
|
||||
});
|
||||
|
||||
// Some peers include a kind hint in addition to the message envelope's URL.
|
||||
const media = {
|
||||
kind: "image", url: "/api/media/sig/html", name: "index.html",
|
||||
} satisfies UIMediaAttachment;
|
||||
act(() => {
|
||||
fake.emit("chat-mislabelled-html", {
|
||||
event: "message",
|
||||
chat_id: "chat-mislabelled-html",
|
||||
text: "file ready",
|
||||
media_urls: [{ kind: "image", url: "/api/media/sig/html", name: "index.html" }],
|
||||
media_urls: [media],
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user