Files
web-alterflixhub/app/actions/view-screen.spec.ts
T
Bkk1234 92a2adad6a refactor: split repo into docs/ mockup/ app/
- move static mockups from resource/ui to mockup/
- move React app scaffold from resource/ui to app/
- move prome.md + images to docs/
- drop empty resource/jsonfile and resource/
- add root .gitignore
- rewrite README for new layout
- fix paths in mockup/index.html (resource/ui -> mockup, docs/prome.md)
2026-10-27 00:55:32 +07:00

37 lines
963 B
TypeScript

import { beforeEach, describe, expect, it, vi } from "vitest";
const mocks = vi.hoisted(() => ({
readAppState: vi.fn(),
}));
vi.mock("@agent-native/core/application-state", () => ({
readAppState: mocks.readAppState,
}));
import action from "./view-screen";
describe("view-screen", () => {
beforeEach(() => {
vi.clearAllMocks();
});
it("returns the current navigation state when present", async () => {
mocks.readAppState.mockResolvedValue({ view: "chat", threadId: "t1" });
const result = await action.run({});
expect(mocks.readAppState).toHaveBeenCalledWith("navigation");
expect(result).toEqual({
navigation: { view: "chat", threadId: "t1" },
});
});
it("returns a fallback message when there is no navigation state", async () => {
mocks.readAppState.mockResolvedValue(null);
const result = await action.run({});
expect(result).toBe("No application state found. Is the app running?");
});
});