Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
  • Loading branch information
salazarm committed Apr 26, 2024
1 parent 7023b6f commit cb606c0
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {MockedProvider} from '@apollo/client/testing';
import {render, screen, waitFor} from '@testing-library/react';
import {Suspense} from 'react';

import {PermissionsProvider, usePermissionsForLocation} from '../../app/Permissions';
import {TrackedSuspense} from '../../app/TrackedSuspense';
Expand Down Expand Up @@ -30,12 +31,14 @@ describe('ReloadRepositoryLocationButton', () => {
render(
<MockedProvider mocks={[buildPermissionsQuery(false)]}>
<PermissionsProvider>
<ReloadRepositoryLocationButton location="foobar" ChildComponent={Test} />
<Suspense>
<ReloadRepositoryLocationButton location="foobar" ChildComponent={Test} />
</Suspense>
</PermissionsProvider>
</MockedProvider>,
);

const button = screen.getByRole('button', {name: /reload/i});
const button = await waitFor(() => screen.getByRole('button', {name: /reload/i}));

await waitFor(() => {
expect(screen.queryByText(/loading permissions\? no/i)).not.toBeNull();
Expand All @@ -48,12 +51,14 @@ describe('ReloadRepositoryLocationButton', () => {
render(
<MockedProvider mocks={[buildPermissionsQuery(true)]}>
<PermissionsProvider>
<ReloadRepositoryLocationButton location="foobar" ChildComponent={Test} />
<Suspense>
<ReloadRepositoryLocationButton location="foobar" ChildComponent={Test} />
</Suspense>
</PermissionsProvider>
</MockedProvider>,
);

const button = screen.getByRole('button', {name: /reload/i});
const button = await waitFor(() => screen.getByRole('button', {name: /reload/i}));

await waitFor(() => {
expect(screen.queryByText(/loading permissions\? no/i)).not.toBeNull();
Expand Down

0 comments on commit cb606c0

Please sign in to comment.