diff --git a/awx/ui_next/src/components/JobList/useWsJobs.test.jsx b/awx/ui_next/src/components/JobList/useWsJobs.test.jsx index 1dead6d5da..c7782b2427 100644 --- a/awx/ui_next/src/components/JobList/useWsJobs.test.jsx +++ b/awx/ui_next/src/components/JobList/useWsJobs.test.jsx @@ -1,7 +1,7 @@ import React from 'react'; import { act } from 'react-dom/test-utils'; -import { mount } from 'enzyme'; import WS from 'jest-websocket-mock'; +import { mountWithContexts } from '../../../testUtils/enzymeHelpers'; import useWsJobs from './useWsJobs'; /* @@ -17,7 +17,8 @@ function TestInner() { return
; } function Test({ jobs, fetch }) { - const syncedJobs = useWsJobs(jobs, fetch); + const qsConfig = {}; + const syncedJobs = useWsJobs(jobs, fetch, qsConfig); return ; } @@ -35,7 +36,7 @@ describe('useWsJobs hook', () => { test('should return jobs list', () => { const jobs = [{ id: 1 }]; - wrapper = mount(); + wrapper = mountWithContexts(); expect(wrapper.find('TestInner').prop('jobs')).toEqual(jobs); WS.clean(); @@ -47,7 +48,7 @@ describe('useWsJobs hook', () => { const jobs = [{ id: 1 }]; await act(async () => { - wrapper = await mount(); + wrapper = await mountWithContexts(); }); await mockServer.connected; @@ -70,7 +71,7 @@ describe('useWsJobs hook', () => { const jobs = [{ id: 1, status: 'running' }]; await act(async () => { - wrapper = await mount(); + wrapper = await mountWithContexts(); }); await mockServer.connected; @@ -105,9 +106,9 @@ describe('useWsJobs hook', () => { global.document.cookie = 'csrftoken=abc123'; const mockServer = new WS('wss://localhost/websocket/'); const jobs = [{ id: 1 }]; - const fetch = jest.fn(); + const fetch = jest.fn(() => []); await act(async () => { - wrapper = await mount(); + wrapper = await mountWithContexts(); }); await mockServer.connected;