Skip to content

Commit ddb3afa

Browse files
committed
update tests
1 parent 468d98e commit ddb3afa

File tree

4 files changed

+7
-33
lines changed

4 files changed

+7
-33
lines changed

apps/nextjs-pages/src/components/seo/__tests__/head.test.tsx

Lines changed: 0 additions & 16 deletions
This file was deleted.

apps/nextjs-pages/src/lib/__tests__/authorization.test.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ test('should not view protected resource if user role does not match and show fa
3939
{ user },
4040
);
4141

42+
await screen.findByText(forbiddenMessage);
43+
4244
expect(screen.queryByText(protectedResource)).not.toBeInTheDocument();
4345

4446
expect(screen.getByText(forbiddenMessage)).toBeInTheDocument();

apps/nextjs-pages/src/pages/index.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ export const HomePage = () => {
1818

1919
return (
2020
<>
21-
<Head description="Welcome to bulletproof react" />
21+
<Head
22+
title={'Bulletproof React'}
23+
description="Welcome to bulletproof react"
24+
/>
2225
<div className="flex h-screen items-center bg-white">
2326
<div className="mx-auto max-w-7xl px-4 py-12 text-center sm:px-6 lg:px-8 lg:py-16">
2427
<h2 className="text-3xl font-extrabold tracking-tight text-gray-900 sm:text-4xl">

apps/nextjs-pages/src/testing/test-utils.tsx

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
import {
2-
render as rtlRender,
3-
screen,
4-
waitForElementToBeRemoved,
5-
} from '@testing-library/react';
1+
import { render as rtlRender } from '@testing-library/react';
62
import userEvent from '@testing-library/user-event';
73
import Cookies from 'js-cookie';
84

@@ -33,15 +29,6 @@ export const loginAsUser = async (user: any) => {
3329
return authUser;
3430
};
3531

36-
export const waitForLoadingToFinish = () =>
37-
waitForElementToBeRemoved(
38-
() => [
39-
...screen.queryAllByTestId(/loading/i),
40-
...screen.queryAllByText(/loading/i),
41-
],
42-
{ timeout: 4000 },
43-
);
44-
4532
const initializeUser = async (user: any) => {
4633
if (typeof user === 'undefined') {
4734
const newUser = await createUser();
@@ -68,8 +55,6 @@ export const renderApp = async (
6855
user: initializedUser,
6956
};
7057

71-
await waitForLoadingToFinish();
72-
7358
return returnValue;
7459
};
7560

0 commit comments

Comments
 (0)