Publish Claude Code Binaries / Stage and publish binaries (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-arm64 (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build linux-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build windows-amd64 (push) Canceled after 0s
Sync Tutti Agent Skills / sync (push) Canceled after 0s
Windows Agent Adapters / Test Windows agent adapters (push) Canceled after 0s
Windows Daemon Adapters / Test Windows daemon adapters (push) Canceled after 0s
Publish Tutti App Runtime / Publish runtime catalog (push) Canceled after 0s
33 lines
1.2 KiB
TypeScript
33 lines
1.2 KiB
TypeScript
import { act, renderHook } from "@testing-library/react";
|
|
import { describe, expect, it } from "vitest";
|
|
import { useScopedProjectMissingState } from "./useScopedProjectMissingState";
|
|
|
|
describe("useScopedProjectMissingState", () => {
|
|
it("keeps results for the same path and rejects stale results after a path change", () => {
|
|
const rendered = renderHook(
|
|
({ scopeKey }) => useScopedProjectMissingState(scopeKey),
|
|
{ initialProps: { scopeKey: "/workspace/one" } }
|
|
);
|
|
|
|
act(() => rendered.result.current[1](true));
|
|
expect(rendered.result.current[0]).toBe(true);
|
|
const reportForFirstPath = rendered.result.current[1];
|
|
|
|
rendered.rerender({ scopeKey: "/workspace/one" });
|
|
expect(rendered.result.current[0]).toBe(true);
|
|
expect(rendered.result.current[1]).toBe(reportForFirstPath);
|
|
|
|
rendered.rerender({ scopeKey: "/workspace/two" });
|
|
expect(rendered.result.current[0]).toBe(false);
|
|
|
|
act(() => reportForFirstPath(true));
|
|
expect(rendered.result.current[0]).toBe(false);
|
|
|
|
act(() => rendered.result.current[1](true));
|
|
expect(rendered.result.current[0]).toBe(true);
|
|
|
|
rendered.rerender({ scopeKey: "/workspace/one" });
|
|
expect(rendered.result.current[0]).toBe(false);
|
|
});
|
|
});
|