From f07e57eb29aa3cfdc142ed248db7b6d2f85392b3 Mon Sep 17 00:00:00 2001 From: karlhadwen Date: Sun, 6 Sep 2020 00:53:44 +0100 Subject: [PATCH] test: added tests to cover all ui & pages --- package.json | 43 +- .../__snapshots__/accordion.test.js.snap | 56 +- .../__snapshots__/card.test.js.snap | 68 +- .../__snapshots__/feature.test.js.snap | 14 +- .../__snapshots__/footer.test.js.snap | 54 +- .../__snapshots__/form.test.js.snap | 30 +- .../__snapshots__/header.test.js.snap | 133 ++ .../__snapshots__/jumbotron.test.js.snap | 44 +- .../__snapshots__/loading.test.js.snap | 4 +- .../__snapshots__/opt-form.test.js.snap | 10 +- .../__snapshots__/player.test.js.snap | 4 +- .../__snapshots__/profiles.test.js.snap | 24 +- src/__tests__/components/header.test.js | 91 + src/__tests__/containers/profiles.test.js | 16 + src/__tests__/pages/browse.test.js | 71 + src/__tests__/pages/home.test.js | 14 + src/__tests__/pages/signin.test.js | 39 + src/__tests__/pages/signup.test.js | 42 + src/__tests__/utils/selection-filter.test.js | 45 + src/app.js | 6 +- src/components/card/index.js | 4 +- src/components/form/styles/form.js | 4 +- src/components/header/index.js | 15 +- src/components/player/index.js | 6 +- src/containers/profiles.js | 5 +- src/pages/browse.js | 4 +- src/pages/index.js | 4 +- src/pages/signin.js | 6 +- src/pages/signup.js | 7 +- src/utils/index.js | 2 +- src/utils/selection-filter.js | 18 + src/utils/selection-map.js | 18 - yarn.lock | 1590 ++++++++++++----- 33 files changed, 1872 insertions(+), 619 deletions(-) create mode 100644 src/__tests__/components/__snapshots__/header.test.js.snap create mode 100644 src/__tests__/components/header.test.js create mode 100644 src/__tests__/containers/profiles.test.js create mode 100644 src/__tests__/pages/browse.test.js create mode 100644 src/__tests__/pages/home.test.js create mode 100644 src/__tests__/pages/signin.test.js create mode 100644 src/__tests__/pages/signup.test.js create mode 100644 src/__tests__/utils/selection-filter.test.js create mode 100644 src/utils/selection-filter.js delete mode 100644 src/utils/selection-map.js diff --git a/package.json b/package.json index bc51dc7..4850e0b 100644 --- a/package.json +++ b/package.json @@ -3,15 +3,14 @@ "version": "0.1.0", "private": true, "dependencies": { - "@testing-library/react": "^10.4.4", - "firebase": "^7.14.0", - "fuse.js": "^5.2.3", + "firebase": "^7.19.1", + "fuse.js": "^6.4.1", "normalize.css": "^8.0.1", - "react": "^16.13.0", - "react-dom": "^16.13.0", - "react-router-dom": "^5.1.2", + "react": "^16.13.1", + "react-dom": "^16.13.1", + "react-router-dom": "^5.2.0", "react-scripts": "3.4.0", - "styled-components": "^5.1.0" + "styled-components": "^5.1.1" }, "scripts": { "start": "react-scripts start", @@ -19,6 +18,9 @@ "test": "react-scripts test --coverage --watchAll", "eject": "react-scripts eject" }, + "eslintConfig": { + "extends": "react-app" + }, "browserslist": { "production": [ ">0.2%", @@ -34,8 +36,14 @@ "jest": { "collectCoverageFrom": [ "/src/**/*.js", + "!/src/app.js", + "!/src/helpers/routes.js", + "!/src/lib/firebase.js", + "!/src/lib/firebase.prod.js", "!/src/index.js", "!/src/seed.js", + "!/src/utils/index.js", + "!/src/pages/index.js", "!/src/global-styles.js", "!/src/components/index.js", "!/src/firebase.prod.js", @@ -56,15 +64,18 @@ ] }, "devDependencies": { + "@testing-library/jest-dom": "^4.2.4", + "@testing-library/react": "^9.3.2", + "@testing-library/user-event": "^12.1.3", "babel-eslint": "^10.1.0", - "babel-plugin-macros": "^2.8.0", - "eslint": "^6.8.0", - "eslint-config-airbnb": "^18.1.0", - "eslint-config-prettier": "^6.10.1", - "eslint-plugin-import": "^2.20.2", - "eslint-plugin-jsx-a11y": "^6.2.3", - "eslint-plugin-prettier": "^3.1.2", - "eslint-plugin-react": "^7.19.0", - "prettier": "^2.0.4" + "eslint": "^7.7.0", + "eslint-config-airbnb": "^18.2.0", + "eslint-config-prettier": "^6.11.0", + "eslint-plugin-import": "^2.22.0", + "eslint-plugin-jsx-a11y": "^6.3.1", + "eslint-plugin-prettier": "^3.1.4", + "eslint-plugin-react": "^7.20.6", + "eslint-plugin-react-hooks": "^4.1.0", + "prettier": "^2.1.1" } } diff --git a/src/__tests__/components/__snapshots__/accordion.test.js.snap b/src/__tests__/components/__snapshots__/accordion.test.js.snap index 8e5035e..61e7881 100644 --- a/src/__tests__/components/__snapshots__/accordion.test.js.snap +++ b/src/__tests__/components/__snapshots__/accordion.test.js.snap @@ -2,24 +2,24 @@ exports[` opens and closes the component 1`] = `

Frequently Asked Questions

What is Netflix? opens and closes the component 1`] = `
How much does Netflix cost? opens and closes the component 1`] = `
Where can I watch? opens and closes the component 1`] = `
How do I cancel? opens and closes the component 1`] = `
What can I watch on Netflix? opens and closes the component 1`] = ` exports[` renders the with populated data 1`] = `

Frequently Asked Questions

What is Netflix? renders the with populated data 1`] = `
How much does Netflix cost? renders the with populated data 1`] = `
Where can I watch? renders the with populated data 1`] = `
How do I cancel? renders the with populated data 1`] = `
What can I watch on Netflix? renders the with and clicks the card feature 1`] = `

Documentaries

Tiger King

Tiger King description

@@ -41,34 +41,34 @@ exports[` renders the with and clicks the card feature 1`] = `

Feel Good

Juno

Juno description

@@ -81,36 +81,36 @@ exports[` renders the with and clicks the card feature 1`] = ` exports[` renders the with populated data 1`] = `

Documentaries

Tiger King

Tiger King description

@@ -119,33 +119,33 @@ exports[` renders the with populated data 1`] = `

Feel Good

Juno

Juno description

diff --git a/src/__tests__/components/__snapshots__/feature.test.js.snap b/src/__tests__/components/__snapshots__/feature.test.js.snap index 6c146b6..a515539 100644 --- a/src/__tests__/components/__snapshots__/feature.test.js.snap +++ b/src/__tests__/components/__snapshots__/feature.test.js.snap @@ -2,10 +2,10 @@ exports[` renders the with just a sub-title 1`] = `

Watch anywhere. Cancel at any time.

@@ -14,10 +14,10 @@ exports[` renders the with just a sub-title 1`] = ` exports[` renders the with just a title 1`] = `

Unlimited films, TV programmes and more.

@@ -26,15 +26,15 @@ exports[` renders the with just a title 1`] = ` exports[` renders the with populated data 1`] = `

Unlimited films, TV programmes and more.

Watch anywhere. Cancel at any time.

diff --git a/src/__tests__/components/__snapshots__/footer.test.js.snap b/src/__tests__/components/__snapshots__/footer.test.js.snap index 5cd58fb..cef28e2 100644 --- a/src/__tests__/components/__snapshots__/footer.test.js.snap +++ b/src/__tests__/components/__snapshots__/footer.test.js.snap @@ -2,132 +2,132 @@ exports[`