Sha256: a902c5e38dcf06c2da50bf6d3c9683c3757f21073d8200e70b1fa10331bcf570
Contents?: true
Size: 1.43 KB
Versions: 12
Compression:
Stored size: 1.43 KB
Contents
import { testActionSnapshotWithFixtures } from '@theforeman/test'; import API from 'foremanReact/API'; import { startPolling, stopPolling, fetchLogs, setActiveTab, downloadReports, toggleFullScreen, } from '../DashboardActions'; import { pollingProcessID, serverMock, activeTab, accountID, } from '../Dashboard.fixtures'; import { rhCloudStateWrapper } from '../../../../ForemanRhCloudTestHelpers'; jest.mock('foremanReact/API'); API.get.mockImplementation(() => serverMock); const runWithGetState = (state, action, params) => dispatch => { const getState = () => rhCloudStateWrapper({ dashboard: state }); action(params)(dispatch, getState); }; const fixtures = { 'should startPolling': () => startPolling(accountID, pollingProcessID), 'should fetchLogs': () => runWithGetState({ activeTab: 'uploads' }, fetchLogs, accountID), 'should stopPolling': () => stopPolling(accountID, pollingProcessID), 'should setActiveTab': () => setActiveTab(accountID, activeTab), 'should downloadReports': () => downloadReports(accountID), 'should toggleFullScreen': () => runWithGetState({ activeTab: 'reports' }, toggleFullScreen, accountID), }; describe('Dashboard actions', () => { const { location } = window; beforeAll(() => { delete window.location; window.location = { href: jest.fn() }; }); afterAll(() => { window.location = location; }); return testActionSnapshotWithFixtures(fixtures); });
Version data entries
12 entries across 12 versions & 1 rubygems