From 84f056294dc5b6d1e857ed9b7f2f825354cda06f Mon Sep 17 00:00:00 2001 From: Marliana Lara Date: Thu, 23 Jan 2020 17:54:06 -0500 Subject: [PATCH] Fix unit test error in HostAdd --- awx/ui_next/src/screens/Host/HostAdd/HostAdd.test.jsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/awx/ui_next/src/screens/Host/HostAdd/HostAdd.test.jsx b/awx/ui_next/src/screens/Host/HostAdd/HostAdd.test.jsx index 6478856675..2a0e419675 100644 --- a/awx/ui_next/src/screens/Host/HostAdd/HostAdd.test.jsx +++ b/awx/ui_next/src/screens/Host/HostAdd/HostAdd.test.jsx @@ -30,7 +30,7 @@ describe('', () => { }); test('handleSubmit should post to api', async () => { - act(() => { + await act(async () => { wrapper.find('HostForm').prop('handleSubmit')(hostData); }); expect(HostsAPI.create).toHaveBeenCalledWith(hostData); @@ -44,12 +44,14 @@ describe('', () => { test('successful form submission should trigger redirect', async () => { HostsAPI.create.mockResolvedValueOnce({ data: { - id: 5, ...hostData, + id: 5, }, }); await waitForElement(wrapper, 'button[aria-label="Save"]'); - await wrapper.find('HostForm').invoke('handleSubmit')(hostData); + await act(async () => { + wrapper.find('HostForm').invoke('handleSubmit')(hostData); + }); expect(history.location.pathname).toEqual('/hosts/5/details'); }); });