import { storeActions } from "@/constants/store-actions"; import { storeMutations } from "@/constants/store-mutations.js"; import { navigationScenarios } from "@/router/router-constants/navigation-scenarios.js"; export function getMountOptions(mockData) { // Define our mocks to attached to the 'global' object for Vue/Jest. const mocks = {}; mocks.dispatchNonBlockingStoreAction = jest.fn(); mocks.dispatchNonBlockingStoreAction.mockImplementation((actionName) => { let actionFilterResult = mockData.actionList.filter( (x) => x.actionName == actionName ); if (actionFilterResult.length > 0 && actionFilterResult.length === 1) { return Promise.resolve({ data: actionFilterResult[0].data, }); } }); // Mock const files mocks.storeActions = storeActions; mocks.storeMutations = storeMutations; mocks.navigationScenarios = navigationScenarios; // Mock $store and $router when accessing this.$store/$router mocks.$store = mockData.store; mocks.$router = mockData.router; const global = { mocks: mocks, }; return { global }; }