mirror of
https://github.com/ansible/awx.git
synced 2026-01-14 03:10:42 -03:30
Fixes console errors thrown about React state updates being be wrapped into act(...) on the inventory form
This commit is contained in:
parent
7e8d0b5883
commit
1faaba4e6c
@ -51,11 +51,13 @@ describe('<InventoryAdd />', () => {
|
||||
];
|
||||
await waitForElement(wrapper, 'isLoading', el => el.length === 0);
|
||||
|
||||
wrapper.find('InventoryForm').prop('onSubmit')({
|
||||
name: 'new Foo',
|
||||
organization: { id: 2 },
|
||||
insights_credential: { id: 47 },
|
||||
instanceGroups,
|
||||
await act(async () => {
|
||||
wrapper.find('InventoryForm').prop('onSubmit')({
|
||||
name: 'new Foo',
|
||||
organization: { id: 2 },
|
||||
insights_credential: { id: 47 },
|
||||
instanceGroups,
|
||||
});
|
||||
});
|
||||
await sleep(1);
|
||||
expect(InventoriesAPI.create).toHaveBeenCalledWith({
|
||||
@ -74,7 +76,9 @@ describe('<InventoryAdd />', () => {
|
||||
|
||||
test('handleCancel should return the user back to the inventories list', async () => {
|
||||
await waitForElement(wrapper, 'isLoading', el => el.length === 0);
|
||||
wrapper.find('Button[aria-label="Cancel"]').simulate('click');
|
||||
await act(async () => {
|
||||
wrapper.find('Button[aria-label="Cancel"]').simulate('click');
|
||||
});
|
||||
expect(history.location.pathname).toEqual('/inventories');
|
||||
});
|
||||
});
|
||||
|
||||
@ -102,7 +102,9 @@ describe('<InventoryEdit />', () => {
|
||||
|
||||
test('handleCancel returns the user to inventory detail', async () => {
|
||||
await waitForElement(wrapper, 'isLoading', el => el.length === 0);
|
||||
wrapper.find('Button[aria-label="Cancel"]').simulate('click');
|
||||
await act(async () => {
|
||||
wrapper.find('Button[aria-label="Cancel"]').simulate('click');
|
||||
});
|
||||
expect(history.location.pathname).toEqual(
|
||||
'/inventories/inventory/1/details'
|
||||
);
|
||||
@ -114,12 +116,14 @@ describe('<InventoryEdit />', () => {
|
||||
{ name: 'Bizz', id: 2 },
|
||||
{ name: 'Buzz', id: 3 },
|
||||
];
|
||||
wrapper.find('InventoryForm').prop('onSubmit')({
|
||||
name: 'Foo',
|
||||
id: 13,
|
||||
organization: { id: 1 },
|
||||
insights_credential: { id: 13 },
|
||||
instanceGroups,
|
||||
await act(async () => {
|
||||
wrapper.find('InventoryForm').prop('onSubmit')({
|
||||
name: 'Foo',
|
||||
id: 13,
|
||||
organization: { id: 1 },
|
||||
insights_credential: { id: 13 },
|
||||
instanceGroups,
|
||||
});
|
||||
});
|
||||
await sleep(0);
|
||||
instanceGroups.map(IG =>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user