Sha256: 15432cc10cafcfd8c58eb7855ea806c8729d2c59427923ca4b9bda7325715390
Contents?: true
Size: 1.19 KB
Versions: 69
Compression:
Stored size: 1.19 KB
Contents
import { testActionSnapshotWithFixtures } from 'react-redux-test-utils'; import api from '../../../../services/api'; import { apiError } from '../../../../utils/helpers'; import { getAnsibleCollectionDetails } from '../AnsibleCollectionDetailsActions'; import { details } from './AnsibleCollectionDetails.fixtures'; jest.mock('../../../../services/api'); jest.mock('../../../../utils/helpers'); const fixtures = { 'should load ansible collection details on success': () => async (dispatch) => { await getAnsibleCollectionDetails('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 getAnsibleCollectionDetails('1')(dispatch); }, }; describe('Ansible Collection details actions', () => { beforeEach(() => { api.get.mockImplementation(async () => ({ data: { results: details, }, })); }); afterEach(() => { jest.resetAllMocks(); jest.restoreAllMocks(); jest.resetModules(); }); testActionSnapshotWithFixtures(fixtures); });
Version data entries
69 entries across 69 versions & 1 rubygems