26 lines
No EOL
790 B
JavaScript
26 lines
No EOL
790 B
JavaScript
import { storeActions } from "@/constants/storeActions";
|
|
|
|
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
|
|
};
|
|
|
|
return { global }
|
|
} |