diff --git a/packages/frontend/editor-ui/src/views/WorkflowHistory.test.ts b/packages/frontend/editor-ui/src/views/WorkflowHistory.test.ts index e101066982..17a0f23704 100644 --- a/packages/frontend/editor-ui/src/views/WorkflowHistory.test.ts +++ b/packages/frontend/editor-ui/src/views/WorkflowHistory.test.ts @@ -1,4 +1,5 @@ import type { MockInstance } from 'vitest'; +import { flushPromises } from '@vue/test-utils'; import { createTestingPinia } from '@pinia/testing'; import { waitFor, within } from '@testing-library/vue'; import userEvent from '@testing-library/user-event'; @@ -229,4 +230,36 @@ describe('WorkflowHistory', () => { }); }); }); + + it('should display archived tag on header if workflow is archived', async () => { + vi.spyOn(workflowsStore, 'fetchWorkflow').mockResolvedValue({ + id: workflowId, + name: 'Test Workflow', + isArchived: true, + } as IWorkflowDb); + + route.params.workflowId = workflowId; + + const { container, getByTestId } = renderComponent({ pinia }); + await flushPromises(); + + expect(getByTestId('workflow-archived-tag')).toBeInTheDocument(); + expect(container.textContent).toContain('Test Workflow'); + }); + + it('should not display archived tag on header if workflow is not archived', async () => { + vi.spyOn(workflowsStore, 'fetchWorkflow').mockResolvedValue({ + id: workflowId, + name: 'Test Workflow', + isArchived: false, + } as IWorkflowDb); + + route.params.workflowId = workflowId; + + const { queryByTestId, container } = renderComponent({ pinia }); + await flushPromises(); + + expect(queryByTestId('workflow-archived-tag')).not.toBeInTheDocument(); + expect(container.textContent).toContain('Test Workflow'); + }); }); diff --git a/packages/frontend/editor-ui/src/views/WorkflowHistory.vue b/packages/frontend/editor-ui/src/views/WorkflowHistory.vue index 792f6b9ef5..01a58a8184 100644 --- a/packages/frontend/editor-ui/src/views/WorkflowHistory.vue +++ b/packages/frontend/editor-ui/src/views/WorkflowHistory.vue @@ -329,9 +329,16 @@ watchEffect(async () => {