Skip to content

Commit

Permalink
fix falling tests
Browse files Browse the repository at this point in the history
  • Loading branch information
skbhagat0502 committed Nov 16, 2023
1 parent 11caf11 commit 89ee315
Showing 1 changed file with 36 additions and 2 deletions.
38 changes: 36 additions & 2 deletions src/screens/MemberDetail/MemberDetail.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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(
<MockedProvider addTypename={false} link={link1}>
<BrowserRouter>
<Provider store={store}>
<I18nextProvider i18n={i18nForTest}>
<MemberDetail {...props} />
</I18nextProvider>
</Provider>
</BrowserRouter>
</MockedProvider>
);
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(
<MockedProvider addTypename={false} link={link2}>
<BrowserRouter>
<Provider store={store}>
<I18nextProvider i18n={i18nForTest}>
<MemberDetail {...props} />
</I18nextProvider>
</Provider>
</BrowserRouter>
</MockedProvider>
);
waitFor(() => expect(screen.getAllByText('No')).toHaveLength(2));
});
});

0 comments on commit 89ee315

Please sign in to comment.