Sha256: 91de86a5813d556b497e977779fa29e3a5b07b082305d500fb8baf499381c0e4
Contents?: true
Size: 1.2 KB
Versions: 45
Compression:
Stored size: 1.2 KB
Contents
import { testActionSnapshotWithFixtures } from 'react-redux-test-utils'; import api from '../../../../services/api'; import { apiError } from '../../../../move_to_foreman/common/helpers'; import { loadModuleStreamDetails } from '../ModuleStreamDetailsActions'; import { details } from './moduleStreamDetails.fixtures'; jest.mock('../../../../services/api'); jest.mock('../../../../move_to_foreman/common/helpers'); const fixtures = { 'should load module stream details on success': () => async (dispatch) => { await loadModuleStreamDetails('1')(dispatch); expect(api.get.mock.calls).toMatchSnapshot('API get call'); expect(apiError).not.toHaveBeenCalled(); }, 'should load fail on bad api call': () => (dispatch) => { api.get.mockImplementation(async () => { throw new Error('some-error'); }); return loadModuleStreamDetails('1')(dispatch); }, }; describe('Module stream details actions', () => { beforeEach(() => { api.get.mockImplementation(async () => ({ data: { results: details, }, })); }); afterEach(() => { jest.resetAllMocks(); jest.restoreAllMocks(); jest.resetModules(); }); testActionSnapshotWithFixtures(fixtures); });
Version data entries
45 entries across 45 versions & 1 rubygems