Download __tests__/hooks/chat/model-command-event-anchor.test.ts from SaylorTwift/openhands: direct link, hf CLI and curl.
- Browser
- Download file 1.05 kB
-
https://huggingface.co/SaylorTwift/openhands/resolve/main/__tests__/hooks/chat/model-command-event-anchor.test.ts
- Command line
-
hf download hf://SaylorTwift/openhands/__tests__/hooks/chat/model-command-event-anchor.test.ts
-
curl -L -o model-command-event-anchor.test.ts https://huggingface.co/SaylorTwift/openhands/resolve/main/__tests__/hooks/chat/model-command-event-anchor.test.ts
1.05 kB
| import { beforeEach, describe, expect, it } from "vitest"; | |
| import { getLastRenderableEventId } from "#/hooks/chat/model-command-event-anchor"; | |
| import { useEventStore } from "#/stores/use-event-store"; | |
| import { | |
| createOtherActionEvent, | |
| createPlanningFileEditorActionEvent, | |
| createUserMessageEvent, | |
| } from "test-utils"; | |
| describe("getLastRenderableEventId", () => { | |
| beforeEach(() => { | |
| useEventStore.getState().clearEvents(); | |
| }); | |
| it("returns null when no renderable events exist", () => { | |
| useEventStore | |
| .getState() | |
| .addEvent(createPlanningFileEditorActionEvent("plan")); | |
| expect(getLastRenderableEventId()).toBeNull(); | |
| }); | |
| it("returns the latest renderable UI event id as a string", () => { | |
| useEventStore.getState().addEvent(createUserMessageEvent("message-1")); | |
| useEventStore | |
| .getState() | |
| .addEvent(createPlanningFileEditorActionEvent("plan")); | |
| useEventStore.getState().addEvent(createOtherActionEvent("action-1")); | |
| expect(getLastRenderableEventId()).toBe("action-1"); | |
| }); | |
| }); | |