Sha256: f773c3de501c8ebf2c4915bce778f9f15c590c99d6c3425845ec92e18b7f56d3
Contents?: true
Size: 1.4 KB
Versions: 2
Compression:
Stored size: 1.4 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 { open } = window; beforeAll(() => { delete window.open; window.open = jest.fn(); }); afterAll(() => { window.open = open; }); return testActionSnapshotWithFixtures(fixtures); });
Version data entries
2 entries across 2 versions & 1 rubygems