30 lines
791 B
JavaScript
30 lines
791 B
JavaScript
import { storeActions } from "@/constants/store-actions";
|
|
import store from "@/store";
|
|
|
|
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 store actions from js file
|
|
mocks.storeActions = storeActions;
|
|
|
|
const global = {
|
|
mocks: mocks,
|
|
plugins: [store]
|
|
};
|
|
|
|
return { global };
|
|
}
|