From 89ee315ef6906c048da0142bf4f58a87f8ae2a75 Mon Sep 17 00:00:00 2001 From: skbhagat0502 Date: Thu, 16 Nov 2023 23:12:43 +0530 Subject: [PATCH] fix falling tests --- .../MemberDetail/MemberDetail.test.tsx | 38 ++++++++++++++++++- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/src/screens/MemberDetail/MemberDetail.test.tsx b/src/screens/MemberDetail/MemberDetail.test.tsx index 6cd61296f6..a4b29fb604 100644 --- a/src/screens/MemberDetail/MemberDetail.test.tsx +++ b/src/screens/MemberDetail/MemberDetail.test.tsx @@ -159,8 +159,8 @@ describe('MemberDetail', () => { expect(screen.getAllByText(/Last name/i)).toBeTruthy(); expect(screen.getAllByText(/Member of Organization/i)).toBeTruthy(); expect(screen.getAllByText(/Language/i)).toBeTruthy(); - expect(screen.getAllByText(/Admin approved/i)).toBeTruthy(); - expect(screen.getAllByText(/Plugin creation allowed/i)).toBeTruthy(); + expect(screen.getByText(/Admin approved/i)).toBeInTheDocument(); + expect(screen.getByText(/Plugin creation allowed/i)).toBeInTheDocument(); expect(screen.getAllByText(/Created on/i)).toBeTruthy(); expect(screen.getAllByText(/Admin for organizations/i)).toBeTruthy(); expect(screen.getAllByText(/Membership requests/i)).toBeTruthy(); @@ -272,4 +272,38 @@ describe('MemberDetail', () => { waitFor(() => userEvent.click(screen.getByText(/Edit Profile/i))); }); + test('should show Yes if plugin creation is allowed and admin approved', async () => { + const props = { + id: 'rishav-jha-mech', + }; + render( + + + + + + + + + + ); + waitFor(() => expect(screen.getByText('Yes')).toHaveLength(2)); + }); + test('should show No if plugin creation is not allowed and not admin approved', async () => { + const props = { + id: 'rishav-jha-mech', + }; + render( + + + + + + + + + + ); + waitFor(() => expect(screen.getAllByText('No')).toHaveLength(2)); + }); });