Skip to content
This repository has been archived by the owner on May 21, 2024. It is now read-only.

Commit

Permalink
test: 🧪 hopefully fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
BSoDium committed May 31, 2022
1 parent d30458f commit b5a97bb
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 27 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"email": "[email protected]",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^12.0.0",
"@testing-library/user-event": "^13.2.1",
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^13.3.0",
"@testing-library/user-event": "^14.2.0",
"@types/jest": "^27.0.1",
"@types/node": "^16.7.13",
"@types/react": "^17.0.20",
Expand Down
16 changes: 16 additions & 0 deletions src/App.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,22 @@ import '@testing-library/jest-dom';
import { render, screen } from '@testing-library/react';
import App from 'App';

beforeAll(() => {
Object.defineProperty(window, 'matchMedia', {
writable: true,
value: jest.fn().mockImplementation((query) => ({
matches: false,
media: query,
onchange: null,
addListener: jest.fn(), // deprecated
removeListener: jest.fn(), // deprecated
addEventListener: jest.fn(),
removeEventListener: jest.fn(),
dispatchEvent: jest.fn(),
})),
});
});

test('renders app correctly', () => {
render(<App />);
const linkElement = screen.getByText(/Logging in/i);
Expand Down
39 changes: 15 additions & 24 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1568,9 +1568,9 @@
"@svgr/plugin-svgo" "^5.5.0"
loader-utils "^2.0.0"

"@testing-library/dom@^8.0.0":
"@testing-library/dom@^8.5.0":
version "8.13.0"
resolved "https://registry.npmjs.org/@testing-library/dom/-/dom-8.13.0.tgz"
resolved "https://registry.yarnpkg.com/@testing-library/dom/-/dom-8.13.0.tgz#bc00bdd64c7d8b40841e27a70211399ad3af46f5"
integrity sha512-9VHgfIatKNXQNaZTtLnalIy0jNZzY35a4S3oi08YAt9Hv1VsfZ/DfA45lM8D/UhtHBGJ4/lGwp0PZkVndRkoOQ==
dependencies:
"@babel/code-frame" "^7.10.4"
Expand All @@ -1582,9 +1582,9 @@
lz-string "^1.4.4"
pretty-format "^27.0.2"

"@testing-library/jest-dom@^5.14.1":
"@testing-library/jest-dom@^5.16.4":
version "5.16.4"
resolved "https://registry.npmjs.org/@testing-library/jest-dom/-/jest-dom-5.16.4.tgz"
resolved "https://registry.yarnpkg.com/@testing-library/jest-dom/-/jest-dom-5.16.4.tgz#938302d7b8b483963a3ae821f1c0808f872245cd"
integrity sha512-Gy+IoFutbMQcky0k+bqqumXZ1cTGswLsFqmNLzNdSKkU9KGV2u9oXhukCbbJ9/LRPKiqwxEE8VpV/+YZlfkPUA==
dependencies:
"@babel/runtime" "^7.9.2"
Expand All @@ -1597,21 +1597,19 @@
lodash "^4.17.15"
redent "^3.0.0"

"@testing-library/react@^12.0.0":
version "12.1.5"
resolved "https://registry.npmjs.org/@testing-library/react/-/react-12.1.5.tgz"
integrity sha512-OfTXCJUFgjd/digLUuPxa0+/3ZxsQmE7ub9kcbW/wi96Bh3o/p5vrETcBGfP17NWPGqeYYl5LTRpwyGoMC4ysg==
"@testing-library/react@^13.3.0":
version "13.3.0"
resolved "https://registry.yarnpkg.com/@testing-library/react/-/react-13.3.0.tgz#bf298bfbc5589326bbcc8052b211f3bb097a97c5"
integrity sha512-DB79aA426+deFgGSjnf5grczDPiL4taK3hFaa+M5q7q20Kcve9eQottOG5kZ74KEr55v0tU2CQormSSDK87zYQ==
dependencies:
"@babel/runtime" "^7.12.5"
"@testing-library/dom" "^8.0.0"
"@types/react-dom" "<18.0.0"
"@testing-library/dom" "^8.5.0"
"@types/react-dom" "^18.0.0"

"@testing-library/user-event@^13.2.1":
version "13.5.0"
resolved "https://registry.npmjs.org/@testing-library/user-event/-/user-event-13.5.0.tgz"
integrity sha512-5Kwtbo3Y/NowpkbRuSepbyMFkZmHgD+vPzYB/RJ4oxt5Gj/avFFBYjhw27cqSVPVw/3a67NK1PbiIr9k4Gwmdg==
dependencies:
"@babel/runtime" "^7.12.5"
"@testing-library/user-event@^14.2.0":
version "14.2.0"
resolved "https://registry.yarnpkg.com/@testing-library/user-event/-/user-event-14.2.0.tgz#8293560f8f80a00383d6c755ec3e0b918acb1683"
integrity sha512-+hIlG4nJS6ivZrKnOP7OGsDu9Fxmryj9vCl8x0ZINtTJcCHs2zLsYif5GzuRiBF2ck5GZG2aQr7Msg+EHlnYVQ==

"@tootallnate/once@1":
version "1.1.2"
Expand Down Expand Up @@ -1845,13 +1843,6 @@
resolved "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.4.tgz"
integrity sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==

"@types/react-dom@<18.0.0":
version "17.0.15"
resolved "https://registry.npmjs.org/@types/react-dom/-/react-dom-17.0.15.tgz"
integrity sha512-Tr9VU9DvNoHDWlmecmcsE5ZZiUkYx+nKBzum4Oxe1K0yJVyBlfbq7H3eXjxXqJczBKqPGq3EgfTru4MgKb9+Yw==
dependencies:
"@types/react" "^17"

"@types/react-dom@^18.0.0":
version "18.0.3"
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-18.0.3.tgz#a022ea08c75a476fe5e96b675c3e673363853831"
Expand All @@ -1868,7 +1859,7 @@
"@types/scheduler" "*"
csstype "^3.0.2"

"@types/react@^17", "@types/react@^17.0.20":
"@types/react@^17.0.20":
version "17.0.44"
resolved "https://registry.npmjs.org/@types/react/-/react-17.0.44.tgz"
integrity sha512-Ye0nlw09GeMp2Suh8qoOv0odfgCoowfM/9MG6WeRD60Gq9wS90bdkdRtYbRkNhXOpG4H+YXGvj4wOWhAC0LJ1g==
Expand Down

0 comments on commit b5a97bb

Please sign in to comment.