feat(editor): Workflow history [WIP]- Add workflow history opening button to main header component (no-changelog) (#7310)

Co-authored-by: Iván Ovejero <ivov.src@gmail.com>
This commit is contained in:
Csaba Tuncsik
2023-10-04 16:45:18 +02:00
committed by GitHub
parent b59b9086d7
commit 4bc9164032
15 changed files with 334 additions and 113 deletions

View File

@@ -10,7 +10,10 @@ import { SETTINGS_STORE_DEFAULT_STATE } from '@/__tests__/utils';
import WorkflowHistoryPage from '@/views/WorkflowHistory.vue';
import { useWorkflowHistoryStore } from '@/stores/workflowHistory.store';
import { STORES, VIEWS } from '@/constants';
import type { WorkflowHistory } from '@/types/workflowHistory';
import {
workflowHistoryDataFactory,
workflowVersionDataFactory,
} from '@/stores/__tests__/utils/workflowHistoryTestUtils';
vi.mock('vue-router', () => {
const params = {};
@@ -29,21 +32,6 @@ vi.mock('vue-router', () => {
};
});
const workflowHistoryDataFactory: () => WorkflowHistory = () => ({
versionId: faker.string.nanoid(),
createdAt: faker.date.past().toDateString(),
authors: Array.from({ length: faker.number.int({ min: 2, max: 5 }) }, faker.person.fullName).join(
', ',
),
});
const workflowVersionDataFactory: () => WorkflowHistory = () => ({
...workflowHistoryDataFactory(),
workflow: {
name: faker.lorem.words(3),
},
});
const workflowId = faker.string.nanoid();
const historyData = Array.from({ length: 5 }, workflowHistoryDataFactory);
const versionData = {
@@ -87,6 +75,7 @@ describe('WorkflowHistory', () => {
route = useRoute();
router = useRouter();
vi.spyOn(workflowHistoryStore, 'getWorkflowHistory').mockResolvedValue(historyData);
vi.spyOn(workflowHistoryStore, 'workflowHistory', 'get').mockReturnValue(historyData);
vi.spyOn(workflowHistoryStore, 'activeWorkflowVersion', 'get').mockReturnValue(versionData);
windowOpenSpy = vi.spyOn(window, 'open').mockImplementation(() => null);