1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 08:21:15 +03:00

Fix unit test error in HostAdd

This commit is contained in:
Marliana Lara 2020-01-23 17:54:06 -05:00
parent b906f8d757
commit 84f056294d
No known key found for this signature in database
GPG Key ID: 38C73B40DFA809EE

View File

@ -30,7 +30,7 @@ describe('<HostAdd />', () => {
});
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('<HostAdd />', () => {
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');
});
});