beforeEach(() => { jest.resetAllMocks(); RecorderManager.clear(); uuid.v4.reset(); });
describe("message.action", () => { beforeEach(() => { jest.resetAllMocks(); }); it("messageAction.fetchMoreMessage - should fetch message list from server", async () => { messageService.fetchMoreMessage.mockReturnValueOnce({ data: { messageList: [] } }); const dispatches = await Thunk(messageAction.fetchMoreMessage).execute({ data: { aloha: "" } }); expect(dispatches.length).toBe(2); expect(dispatches[0].isPlainObject()).toBe(true); expect(dispatches[0].getAction()).toEqual({ type: actionTypes.MESSAGE_FETCH_MORE }); expect(dispatches[1].isPlainObject()).toBe(true); expect(dispatches[1].getAction()).toEqual({ type: actionTypes.MESSAGE_FETCH_MORE_SUCCESS, payload: { messageList: [] } }); }); });
describe('mock-capture', () => { describe('captureMockActivity', () => { beforeEach(() => { jest.resetAllMocks(); }); it('should set stack and inject functions', () => { const params = [1, 2]; const result = 3; const mockMeta = { path: 'dir1/file1.js', moduleName: 'fs', name: 'readFileSync', }; const meta = { name: 'fun1', }; const types = { params: ['Number', 'Number'], result: 'Number', }; const captureIndex = 0; const data = { mockMeta, params, result }; captureMockActivity(captureIndex, meta, data); const addr = ['recorderState', 'dir1/file1.js', 'exportedFunctions', 'fun1', 'captures', 0, 'mocks', 'fs', 'readFileSync', 'captures', 0]; expect(RecorderManager.recordTrio.mock.calls).toEqual([ [addr, params, result, types], ]); }); }); });
describe('todosService', () => { beforeEach(() => jest.resetAllMocks());
// Make sure to reset the mocks after each test beforeEach(() => { jest.resetAllMocks(); });
describe('user-function-pre', () => { describe('pre', () => { beforeEach(() => { jest.resetAllMocks(); }); it('should set stack and inject functions', () => {
jest.resetAllMocks(); _.shuffle = jest.fn(); _.shuffle.mockImplementation(arr => arr);
describe("team.action", () => { beforeEach(() => { jest.resetAllMocks(); }); it("teamAction.switchTeam - should switch current team", async () => {
describe("user.action", () => { beforeEach(() => { jest.resetAllMocks(); }); it("should try auto sign in user", async () => {
describe("channel.action", () => { beforeEach(() => { jest.resetAllMocks(); }); it("channelAction.switchChannel - should switchChannel", async () => {
describe("movie.action", () => { beforeEach(() => { jest.resetAllMocks(); }); it("should fetch movie collection list from server", async () => {
describe("user.action", () => { beforeEach(() => { jest.resetAllMocks(); });
beforeEach(() => { jest.resetAllMocks(); RecorderManager.clear(); uuid.v4.reset(); });
beforeEach(() => { jest.resetAllMocks(); });