Open lepffm opened 1 year ago
// 1. make all export service file [ exportAll.js ] export { default as XXService } from 'XXService';
export { default as XXService } from 'XXService';
// mocking file [ api-mocks.js j]
import * as _apis from './exportAll.js' const makeMock = api => { Object.getOwnerPropertynames(api).forEach(val => { api[val] = jest.fn().mockImplementation((...args) => { console.error('${val} ${args}`); return Promise.resolve(null): }).mockName(val); }); }; Object.values(_apis).forEach(api => makeMock(api) );
// 1. make all export service file [ exportAll.js ]
export { default as XXService } from 'XXService';
// mocking file [ api-mocks.js j]