fix(ci): spread real @fusion/core into partial test mocks; deterministic editor save test
This commit is contained in:
@@ -243,7 +243,11 @@ describe("WorkflowNodeEditor — U10 columns/traits/holds", () => {
|
||||
vi.mocked(compileWorkflow).mockResolvedValue({ steps: [] });
|
||||
|
||||
render(<WorkflowNodeEditor isOpen onClose={() => {}} addToast={() => {}} />);
|
||||
fireEvent.click((await screen.findByText("Save")).closest("button")!);
|
||||
// Wait for the column panel to hydrate before saving — saving earlier
|
||||
// races the async columns state and flowToIr would emit a v1 IR.
|
||||
await screen.findByText("Save");
|
||||
await waitFor(() => expect(screen.getAllByLabelText(/Column name/i).length).toBeGreaterThan(0));
|
||||
fireEvent.click(screen.getByText("Save").closest("button")!);
|
||||
|
||||
await waitFor(() => expect(updateWorkflow).toHaveBeenCalled());
|
||||
const [, updates] = vi.mocked(updateWorkflow).mock.calls[0];
|
||||
|
||||
@@ -6,6 +6,7 @@ import { PageErrorBoundary } from "../ErrorBoundary";
|
||||
import type { Task } from "@fusion/core";
|
||||
|
||||
vi.mock("../../api", () => ({
|
||||
fetchBoardWorkflows: vi.fn().mockResolvedValue({ flagEnabled: false, defaultWorkflowId: "", workflows: [], taskWorkflowIds: {} }),
|
||||
fetchWorkflowSteps: vi.fn().mockResolvedValue([]),
|
||||
}));
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import { Board } from "../Board";
|
||||
import { loadAllAppCss } from "../../test/cssFixture";
|
||||
|
||||
vi.mock("../../api", () => ({
|
||||
fetchBoardWorkflows: vi.fn().mockResolvedValue({ flagEnabled: false, defaultWorkflowId: "", workflows: [], taskWorkflowIds: {} }),
|
||||
fetchWorkflowSteps: vi.fn().mockResolvedValue([]),
|
||||
}));
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import { ListView } from "../ListView";
|
||||
import "../../styles.css";
|
||||
|
||||
vi.mock("../../api", () => ({
|
||||
fetchBoardWorkflows: vi.fn().mockResolvedValue({ flagEnabled: false, defaultWorkflowId: "", workflows: [], taskWorkflowIds: {} }),
|
||||
fetchWorkflowSteps: vi.fn().mockResolvedValue([]),
|
||||
fetchModels: vi.fn().mockResolvedValue({ models: [], favoriteProviders: [], favoriteModels: [] }),
|
||||
fetchSettings: vi.fn().mockResolvedValue({
|
||||
|
||||
@@ -66,7 +66,8 @@ vi.mock("../chat.js", () => ({
|
||||
__resetChatState: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock("@fusion/core", () => ({
|
||||
vi.mock("@fusion/core", async (importOriginal) => ({
|
||||
...(await importOriginal<typeof import("@fusion/core")>()),
|
||||
ChatStore: class MockChatStore extends EventEmitter {
|
||||
init = mockInit;
|
||||
createSession = mockCreateSession;
|
||||
|
||||
@@ -22,7 +22,8 @@ const { mockSummarizeTitle } = vi.hoisted(() => ({
|
||||
mockSummarizeTitle: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock("@fusion/core", () => ({
|
||||
vi.mock("@fusion/core", async (importOriginal) => ({
|
||||
...(await importOriginal<typeof import("@fusion/core")>()),
|
||||
summarizeTitle: mockSummarizeTitle,
|
||||
DASHBOARD_USER_ID: "dashboard",
|
||||
normalizeMessageParticipant: (id: string, type: "user" | "agent" | "system") => {
|
||||
|
||||
@@ -16,8 +16,10 @@ const mockGetNode = vi.fn();
|
||||
const mockAgentStoreInit = vi.fn().mockResolvedValue(undefined);
|
||||
const mockAgentStoreGetAgent = vi.fn().mockResolvedValue(null);
|
||||
|
||||
vi.mock("@fusion/core", () => {
|
||||
vi.mock("@fusion/core", async (importOriginal) => {
|
||||
const __actual = await importOriginal<typeof import("@fusion/core")>();
|
||||
return {
|
||||
...__actual,
|
||||
CentralCore: class MockCentralCore {
|
||||
init = mockInit;
|
||||
close = mockClose;
|
||||
|
||||
@@ -11,8 +11,10 @@ const mockGetBudgetStatus = vi.fn();
|
||||
const mockResetBudgetUsage = vi.fn();
|
||||
const mockChatStoreInit = vi.fn().mockResolvedValue(undefined);
|
||||
|
||||
vi.mock("@fusion/core", () => {
|
||||
vi.mock("@fusion/core", async (importOriginal) => {
|
||||
const __actual = await importOriginal<typeof import("@fusion/core")>();
|
||||
return {
|
||||
...__actual,
|
||||
AgentStore: class MockAgentStore {
|
||||
init = mockInit;
|
||||
getAgent = mockGetAgent;
|
||||
|
||||
@@ -12,8 +12,10 @@ const mockListAgents = vi.fn().mockResolvedValue([]);
|
||||
const mockExportAgentsToDirectory = vi.fn();
|
||||
const mockChatStoreInit = vi.fn().mockResolvedValue(undefined);
|
||||
|
||||
vi.mock("@fusion/core", () => {
|
||||
vi.mock("@fusion/core", async (importOriginal) => {
|
||||
const __actual = await importOriginal<typeof import("@fusion/core")>();
|
||||
return {
|
||||
...__actual,
|
||||
AgentStore: class MockAgentStore {
|
||||
init = mockInit;
|
||||
listAgents = mockListAgents;
|
||||
|
||||
@@ -11,8 +11,10 @@ const mockRevokeApiKey = vi.fn();
|
||||
const mockListAgents = vi.fn().mockResolvedValue([]);
|
||||
const mockChatStoreInit = vi.fn().mockResolvedValue(undefined);
|
||||
|
||||
vi.mock("@fusion/core", () => {
|
||||
vi.mock("@fusion/core", async (importOriginal) => {
|
||||
const __actual = await importOriginal<typeof import("@fusion/core")>();
|
||||
return {
|
||||
...__actual,
|
||||
AgentStore: class MockAgentStore {
|
||||
init = mockInit;
|
||||
getAgent = mockGetAgent;
|
||||
|
||||
@@ -97,8 +97,10 @@ const mockIsValidPermission = vi.fn(
|
||||
);
|
||||
const mockChatStoreInit = vi.fn().mockResolvedValue(undefined);
|
||||
|
||||
vi.mock("@fusion/core", () => {
|
||||
vi.mock("@fusion/core", async (importOriginal) => {
|
||||
const __actual = await importOriginal<typeof import("@fusion/core")>();
|
||||
return {
|
||||
...__actual,
|
||||
AgentStore: class MockAgentStore {
|
||||
init = mockInit;
|
||||
getAgent = mockGetAgent;
|
||||
|
||||
@@ -17,7 +17,8 @@ const {
|
||||
mockAll: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock("@fusion/core", () => ({
|
||||
vi.mock("@fusion/core", async (importOriginal) => ({
|
||||
...(await importOriginal<typeof import("@fusion/core")>()),
|
||||
AgentStore: class MockAgentStore {
|
||||
init = mockInit;
|
||||
getAgent = mockGetAgent;
|
||||
|
||||
@@ -12,8 +12,10 @@ const mockGetRatingSummary = vi.fn();
|
||||
const mockDeleteRating = vi.fn();
|
||||
const mockChatStoreInit = vi.fn().mockResolvedValue(undefined);
|
||||
|
||||
vi.mock("@fusion/core", () => {
|
||||
vi.mock("@fusion/core", async (importOriginal) => {
|
||||
const __actual = await importOriginal<typeof import("@fusion/core")>();
|
||||
return {
|
||||
...__actual,
|
||||
AgentStore: class MockAgentStore {
|
||||
init = mockInit;
|
||||
addRating = mockAddRating;
|
||||
|
||||
@@ -11,8 +11,10 @@ const mockRollbackConfig = vi.fn();
|
||||
const mockListAgents = vi.fn().mockResolvedValue([]);
|
||||
const mockChatStoreInit = vi.fn().mockResolvedValue(undefined);
|
||||
|
||||
vi.mock("@fusion/core", () => {
|
||||
vi.mock("@fusion/core", async (importOriginal) => {
|
||||
const __actual = await importOriginal<typeof import("@fusion/core")>();
|
||||
return {
|
||||
...__actual,
|
||||
AgentStore: class MockAgentStore {
|
||||
init = mockInit;
|
||||
getAgent = mockGetAgent;
|
||||
|
||||
@@ -22,8 +22,10 @@ const mockChatStoreInit = vi.fn().mockResolvedValue(undefined);
|
||||
// Mock getRunAuditEvents
|
||||
const mockGetRunAuditEvents = vi.fn().mockReturnValue([]);
|
||||
|
||||
vi.mock("@fusion/core", () => {
|
||||
vi.mock("@fusion/core", async (importOriginal) => {
|
||||
const __actual = await importOriginal<typeof import("@fusion/core")>();
|
||||
return {
|
||||
...__actual,
|
||||
AgentStore: class MockAgentStore {
|
||||
init = mockInit;
|
||||
startHeartbeatRun = mockStartHeartbeatRun;
|
||||
|
||||
@@ -34,8 +34,10 @@ class MockAgentCompaniesParseError extends Error {
|
||||
}
|
||||
}
|
||||
|
||||
vi.mock("@fusion/core", () => {
|
||||
vi.mock("@fusion/core", async (importOriginal) => {
|
||||
const __actual = await importOriginal<typeof import("@fusion/core")>();
|
||||
return {
|
||||
...__actual,
|
||||
AgentStore: class MockAgentStore {
|
||||
init = mockInit;
|
||||
createAgent = mockCreateAgent;
|
||||
|
||||
@@ -17,7 +17,8 @@ const {
|
||||
mockChatStoreInit: vi.fn().mockResolvedValue(undefined),
|
||||
}));
|
||||
|
||||
vi.mock("@fusion/core", () => ({
|
||||
vi.mock("@fusion/core", async (importOriginal) => ({
|
||||
...(await importOriginal<typeof import("@fusion/core")>()),
|
||||
AgentStore: class MockAgentStore {
|
||||
init = mockInit;
|
||||
getAgent = mockGetAgent;
|
||||
|
||||
@@ -35,7 +35,8 @@ class MockApprovalRequestStore {
|
||||
}
|
||||
}
|
||||
|
||||
vi.mock("@fusion/core", () => ({ ApprovalRequestStore: MockApprovalRequestStore, AgentStore: class { async init() {} async getAgent() { return null; } } }));
|
||||
vi.mock("@fusion/core", async (importOriginal) => ({
|
||||
...(await importOriginal<typeof import("@fusion/core")>()), ApprovalRequestStore: MockApprovalRequestStore, AgentStore: class { async init() {} async getAgent() { return null; } } }));
|
||||
vi.mock("@fusion/engine", () => ({
|
||||
executeApprovedAgentProvisioning: vi.fn(),
|
||||
executeApprovedWorktrunkInstall: vi.fn(),
|
||||
|
||||
@@ -77,7 +77,8 @@ const executeApprovedAgentProvisioning = vi.fn(async (request: any) => {
|
||||
throw new Error(`Unsupported provisioning tool: ${tool}`);
|
||||
});
|
||||
|
||||
vi.mock("@fusion/core", () => ({
|
||||
vi.mock("@fusion/core", async (importOriginal) => ({
|
||||
...(await importOriginal<typeof import("@fusion/core")>()),
|
||||
ApprovalRequestStore: MockApprovalRequestStore,
|
||||
AgentStore: MockAgentStore,
|
||||
}));
|
||||
|
||||
@@ -34,8 +34,10 @@ const mockChatStoreInit = vi.fn().mockResolvedValue(undefined);
|
||||
const mockAgentStoreInit = vi.fn().mockResolvedValue(undefined);
|
||||
const mockAgentStoreGetAgent = vi.fn().mockResolvedValue(null);
|
||||
|
||||
vi.mock("@fusion/core", () => {
|
||||
vi.mock("@fusion/core", async (importOriginal) => {
|
||||
const __actual = await importOriginal<typeof import("@fusion/core")>();
|
||||
return {
|
||||
...__actual,
|
||||
CentralCore: class MockCentralCore {
|
||||
init = mockInit;
|
||||
close = mockClose;
|
||||
|
||||
@@ -39,8 +39,10 @@ const mockChatStoreInit = vi.fn().mockResolvedValue(undefined);
|
||||
const mockAgentStoreInit = vi.fn().mockResolvedValue(undefined);
|
||||
const mockAgentStoreGetAgent = vi.fn().mockResolvedValue(null);
|
||||
|
||||
vi.mock("@fusion/core", () => {
|
||||
vi.mock("@fusion/core", async (importOriginal) => {
|
||||
const __actual = await importOriginal<typeof import("@fusion/core")>();
|
||||
return {
|
||||
...__actual,
|
||||
CentralCore: class MockCentralCore {
|
||||
init = mockInit;
|
||||
close = mockClose;
|
||||
|
||||
@@ -21,8 +21,10 @@ const mockChatStoreInit = vi.fn().mockResolvedValue(undefined);
|
||||
const mockAgentStoreInit = vi.fn().mockResolvedValue(undefined);
|
||||
const mockAgentStoreGetAgent = vi.fn().mockResolvedValue(null);
|
||||
|
||||
vi.mock("@fusion/core", () => {
|
||||
vi.mock("@fusion/core", async (importOriginal) => {
|
||||
const __actual = await importOriginal<typeof import("@fusion/core")>();
|
||||
return {
|
||||
...__actual,
|
||||
CentralCore: class MockCentralCore {
|
||||
init = mockInit;
|
||||
close = mockClose;
|
||||
|
||||
@@ -11,8 +11,10 @@ const mockResolveAgent = vi.fn();
|
||||
const mockListAgents = vi.fn().mockResolvedValue([]);
|
||||
const mockChatStoreInit = vi.fn().mockResolvedValue(undefined);
|
||||
|
||||
vi.mock("@fusion/core", () => {
|
||||
vi.mock("@fusion/core", async (importOriginal) => {
|
||||
const __actual = await importOriginal<typeof import("@fusion/core")>();
|
||||
return {
|
||||
...__actual,
|
||||
AgentStore: class MockAgentStore {
|
||||
init = mockInit;
|
||||
getAgent = mockGetAgent;
|
||||
|
||||
@@ -4,7 +4,8 @@ import { request } from "../test-request.js";
|
||||
const mockGetRunDetail = vi.fn();
|
||||
const mockGetRunAuditEvents = vi.fn();
|
||||
|
||||
vi.mock("@fusion/core", () => ({
|
||||
vi.mock("@fusion/core", async (importOriginal) => ({
|
||||
...(await importOriginal<typeof import("@fusion/core")>()),
|
||||
AgentStore: class MockAgentStore {
|
||||
init = vi.fn().mockResolvedValue(undefined);
|
||||
getRunDetail = mockGetRunDetail;
|
||||
|
||||
@@ -4,7 +4,8 @@ import { request } from "../test-request.js";
|
||||
const mockGetRunDetail = vi.fn();
|
||||
const mockGetRunAuditEvents = vi.fn();
|
||||
|
||||
vi.mock("@fusion/core", () => ({
|
||||
vi.mock("@fusion/core", async (importOriginal) => ({
|
||||
...(await importOriginal<typeof import("@fusion/core")>()),
|
||||
AgentStore: class MockAgentStore {
|
||||
init = vi.fn().mockResolvedValue(undefined);
|
||||
getRunDetail = mockGetRunDetail;
|
||||
|
||||
@@ -5,7 +5,8 @@ const coreInteropMocks = vi.hoisted(() => ({
|
||||
readStoredCredentialsFromAuthFile: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock("@fusion/core", () => ({
|
||||
vi.mock("@fusion/core", async (importOriginal) => ({
|
||||
...(await importOriginal<typeof import("@fusion/core")>()),
|
||||
choosePreferredStoredCredential: coreInteropMocks.choosePreferredStoredCredential,
|
||||
readStoredCredentialsFromAuthFile: coreInteropMocks.readStoredCredentialsFromAuthFile,
|
||||
}));
|
||||
|
||||
@@ -24,7 +24,8 @@ const dockerClientServiceMock = {
|
||||
getContainerInfo: vi.fn(),
|
||||
};
|
||||
|
||||
vi.mock("@fusion/core", () => ({
|
||||
vi.mock("@fusion/core", async (importOriginal) => ({
|
||||
...(await importOriginal<typeof import("@fusion/core")>()),
|
||||
DockerProvisioningService: vi.fn().mockImplementation(() => ({
|
||||
provision: provisionMock,
|
||||
deprovision: deprovisionMock,
|
||||
|
||||
Reference in New Issue
Block a user