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');
});
});