fix(app): restore archive and composer CI checks
This commit is contained in:
@@ -3,6 +3,7 @@ import { QueryClient } from "@tanstack/react-query";
|
||||
import { beforeEach, describe, expect, it } from "vitest";
|
||||
import type { Agent } from "@/stores/session-store";
|
||||
import { useSessionStore } from "@/stores/session-store";
|
||||
import { agentHistoryQueryKey } from "./agent-history-query-key";
|
||||
import { __private__, applyArchivedAgentCloseResults } from "./use-archive-agent";
|
||||
|
||||
function makeAgent(overrides: Partial<Agent> = {}): Agent {
|
||||
@@ -112,6 +113,17 @@ describe("useArchiveAgent", () => {
|
||||
queryClient.setQueryData(["allAgents", "server-a"], {
|
||||
entries: [{ agent: { id: "agent-1" } }, { agent: { id: "agent-2" } }],
|
||||
});
|
||||
queryClient.setQueryData(agentHistoryQueryKey("server-a"), {
|
||||
pages: [
|
||||
{
|
||||
agents: [
|
||||
{ id: "agent-1", archivedAt: null },
|
||||
{ id: "agent-2", archivedAt: null },
|
||||
],
|
||||
},
|
||||
],
|
||||
pageParams: [null],
|
||||
});
|
||||
|
||||
applyArchivedAgentCloseResults({
|
||||
queryClient,
|
||||
@@ -131,6 +143,17 @@ describe("useArchiveAgent", () => {
|
||||
expect(queryClient.getQueryData(["allAgents", "server-a"])).toEqual({
|
||||
entries: [{ agent: { id: "agent-2" } }],
|
||||
});
|
||||
expect(queryClient.getQueryData(agentHistoryQueryKey("server-a"))).toEqual({
|
||||
pages: [
|
||||
{
|
||||
agents: [
|
||||
{ id: "agent-1", archivedAt: new Date("2026-04-01T04:00:00.000Z") },
|
||||
{ id: "agent-2", archivedAt: null },
|
||||
],
|
||||
},
|
||||
],
|
||||
pageParams: [null],
|
||||
});
|
||||
});
|
||||
|
||||
it("can apply archived agent close results without invalidating cached lists", () => {
|
||||
@@ -143,6 +166,14 @@ describe("useArchiveAgent", () => {
|
||||
queryClient.setQueryData(["allAgents", "server-a"], {
|
||||
entries: [{ agent: { id: "agent-1" } }, { agent: { id: "agent-2" } }],
|
||||
});
|
||||
queryClient.setQueryData(agentHistoryQueryKey("server-a"), {
|
||||
pages: [
|
||||
{
|
||||
agents: [{ id: "agent-1", archivedAt: null }],
|
||||
},
|
||||
],
|
||||
pageParams: [null],
|
||||
});
|
||||
|
||||
applyArchivedAgentCloseResults({
|
||||
queryClient,
|
||||
@@ -153,5 +184,14 @@ describe("useArchiveAgent", () => {
|
||||
|
||||
expect(queryClient.getQueryState(["sidebarAgentsList", "server-a"])?.isInvalidated).toBe(false);
|
||||
expect(queryClient.getQueryState(["allAgents", "server-a"])?.isInvalidated).toBe(false);
|
||||
expect(queryClient.getQueryState(agentHistoryQueryKey("server-a"))?.isInvalidated).toBe(false);
|
||||
expect(queryClient.getQueryData(agentHistoryQueryKey("server-a"))).toEqual({
|
||||
pages: [
|
||||
{
|
||||
agents: [{ id: "agent-1", archivedAt: new Date("2026-04-01T04:00:00.000Z") }],
|
||||
},
|
||||
],
|
||||
pageParams: [null],
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user