From 50b19bc994fd4dac8af5ed3bc4b4f7010e767728 Mon Sep 17 00:00:00 2001 From: fgonzalez Date: Wed, 14 Aug 2024 17:34:12 -0300 Subject: [PATCH] fix: set loading false after fetchdata --- src/components/CollaborationInvite/index.js | 6 +++--- src/components/CollaborationInvite/index.test.js | 14 ++++++++------ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/components/CollaborationInvite/index.js b/src/components/CollaborationInvite/index.js index 229350a8e..8d77e6ec1 100644 --- a/src/components/CollaborationInvite/index.js +++ b/src/components/CollaborationInvite/index.js @@ -99,12 +99,12 @@ export const CollaboratorsInvite = InjectAppServices( setEmail(jwtDecode(token).email); } catch {} - sendInvitationData(null); - + await sendInvitationData(null); setLoading(false); }; fetchData(); + // eslint-disable-next-line }, []); @@ -156,7 +156,7 @@ export const CollaboratorsInvite = InjectAppServices( validate={validate} > -
+
{ ); // Assert + const loader = screen.getByTestId('wrapper-loading'); + await waitForElementToBeRemoved(loader); + act(() => expect(screen.getByTestId('unexpected-error')).toBeInTheDocument()); act(() => expect( @@ -68,10 +71,9 @@ describe('CollaborationInvite', () => { ); // Assert - act(() => - expect(screen.getByTestId('unexpected-error')).not.toContainHTML( - '

validation_messages.error_expired_invitation_link

', - ), - ); + const loader = screen.getByTestId('wrapper-loading'); + await waitForElementToBeRemoved(loader); + + act(() => expect(screen.getByTestId('collaboration-invite-form')).toBeInTheDocument()); }); });