diff --git a/package-lock.json b/package-lock.json index cc018a50..26d6d0c1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,21 +1,19 @@ { "name": "my-pets", - "version": "0.0.37", + "version": "0.1.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "my-pets", - "version": "0.0.37", + "version": "0.1.0", "license": "MIT", "dependencies": { "@apollo/client": "^3.3.14", "@testing-library/jest-dom": "^5.11.6", "@testing-library/react": "^11.2.2", "@testing-library/user-event": "^12.5.0", - "axios": "^0.21.1", "crypto-js": "^4.0.0", - "dayjs": "^1.9.7", "env-cmd": "^10.1.0", "graphql": "^15.5.0", "node-sass": "^4.14.1", @@ -3839,14 +3837,6 @@ "node": ">=4" } }, - "node_modules/axios": { - "version": "0.21.1", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz", - "integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==", - "dependencies": { - "follow-redirects": "^1.10.0" - } - }, "node_modules/axobject-query": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-2.2.0.tgz", @@ -6338,11 +6328,6 @@ "node": ">=10" } }, - "node_modules/dayjs": { - "version": "1.10.4", - "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.10.4.tgz", - "integrity": "sha512-RI/Hh4kqRc1UKLOAf/T5zdMMX5DQIlDxwUe3wSyMMnEbGunnpENCdbUgM+dW7kXidZqCttBrmw7BhN4TMddkCw==" - }, "node_modules/debug": { "version": "4.3.1", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", @@ -25169,14 +25154,6 @@ "resolved": "https://registry.npmjs.org/axe-core/-/axe-core-4.2.1.tgz", "integrity": "sha512-evY7DN8qSIbsW2H/TWQ1bX3sXN1d4MNb5Vb4n7BzPuCwRHdkZ1H2eNLuSh73EoQqkGKUtju2G2HCcjCfhvZIAA==" }, - "axios": { - "version": "0.21.1", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz", - "integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==", - "requires": { - "follow-redirects": "^1.10.0" - } - }, "axobject-query": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-2.2.0.tgz", @@ -27186,11 +27163,6 @@ "whatwg-url": "^8.0.0" } }, - "dayjs": { - "version": "1.10.4", - "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.10.4.tgz", - "integrity": "sha512-RI/Hh4kqRc1UKLOAf/T5zdMMX5DQIlDxwUe3wSyMMnEbGunnpENCdbUgM+dW7kXidZqCttBrmw7BhN4TMddkCw==" - }, "debug": { "version": "4.3.1", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", diff --git a/package.json b/package.json index 09214028..000da72e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "my-pets", - "version": "0.0.37", + "version": "0.1.0", "author": "Nicolás Omar González Passerino", "license": "MIT", "private": false, @@ -27,9 +27,7 @@ "@testing-library/jest-dom": "^5.11.6", "@testing-library/react": "^11.2.2", "@testing-library/user-event": "^12.5.0", - "axios": "^0.21.1", "crypto-js": "^4.0.0", - "dayjs": "^1.9.7", "env-cmd": "^10.1.0", "graphql": "^15.5.0", "node-sass": "^4.14.1", diff --git a/src/components/core/app/app.test.js b/src/components/core/app/app.test.js index c5af45c1..bbca6d41 100644 --- a/src/components/core/app/app.test.js +++ b/src/components/core/app/app.test.js @@ -8,15 +8,17 @@ import store from '../../../redux/reducers' import App from './app' describe('[App]', () => { - test('renders App component without props', () => { - render( - - - - - - ) - const element = screen.getByText(/Welcome to My Pets/i) - expect(element).toBeInTheDocument() + describe('[HAPPY PATH]', () => { + test('Renders without props', () => { + render( + + + + + + ) + const element = screen.getByText(/Welcome to My Pets/i) + expect(element).toBeInTheDocument() + }) }) }) diff --git a/src/components/core/header/header.test.js b/src/components/core/header/header.test.js index 0d4ba2c7..d4ec01ba 100644 --- a/src/components/core/header/header.test.js +++ b/src/components/core/header/header.test.js @@ -8,15 +8,17 @@ import store from '../../../redux/reducers' import Header from './header' describe('[Header]', () => { - test('Render Header with a dummy "name" prop', () => { - render( - - -
- - - ) - const element = screen.getByText('TEST') - expect(element).toBeInTheDocument() + describe('[HAPPY PATH]', () => { + test('Render with a dummy "name" prop', () => { + render( + + +
+ + + ) + const element = screen.getByText('TEST') + expect(element).toBeInTheDocument() + }) }) }) diff --git a/src/components/core/home/home.test.js b/src/components/core/home/home.test.js index b9245c6f..a2e19742 100644 --- a/src/components/core/home/home.test.js +++ b/src/components/core/home/home.test.js @@ -4,9 +4,13 @@ import Home from './home' // HELPER FUNCTIONS import { setLoggedUser } from '../../../functions/local-storage' -test('Renders with a dummy logged User', () => { - setLoggedUser({ name: 'Test' }) - render() - const element = screen.getByText(`HELLO TEST`) - expect(element).toBeInTheDocument() +describe('[Home]', () => { + describe('[HAPPY PATH]', () => { + test('Renders with a dummy logged User', () => { + setLoggedUser({ name: 'Test' }) + render() + const element = screen.getByText(`HELLO TEST`) + expect(element).toBeInTheDocument() + }) + }) }) diff --git a/src/components/core/login-form/login-form.test.js b/src/components/core/login-form/login-form.test.js index a0bf6b5e..be2a3cfd 100644 --- a/src/components/core/login-form/login-form.test.js +++ b/src/components/core/login-form/login-form.test.js @@ -8,15 +8,17 @@ import store from '../../../redux/reducers' import LoginForm from './login-form' describe('[LoginForm]', () => { - test('Renders a "Login" Form without props', () => { - render( - - - - - - ) - const element = screen.getByText('Password') - expect(element).toBeInTheDocument() + describe('[HAPPY PATH]', () => { + test('Renders without props', () => { + render( + + + + + + ) + const element = screen.getByText('Password') + expect(element).toBeInTheDocument() + }) }) }) diff --git a/src/components/shared/form-button/form-button.test.js b/src/components/shared/form-button/form-button.test.js index 99512861..980b89f7 100644 --- a/src/components/shared/form-button/form-button.test.js +++ b/src/components/shared/form-button/form-button.test.js @@ -1,12 +1,16 @@ import { render, screen } from '@testing-library/react' import FormButton from './form-button' -test('Renders a FormButton using required props only', () => { - const props = { - type: 'button', - label: 'Test' - } - render() - const element = screen.getByText(props.label) - expect(element).toBeInTheDocument() +describe('[FormButton]', () => { + describe('[HAPPY PATH]', () => { + test('Renders using required props only', () => { + const props = { + type: 'button', + label: 'Test' + } + render() + const element = screen.getByText(props.label) + expect(element).toBeInTheDocument() + }) + }) }) diff --git a/src/components/shared/form-input/form-input.test.js b/src/components/shared/form-input/form-input.test.js index aa200455..e26ed1f5 100644 --- a/src/components/shared/form-input/form-input.test.js +++ b/src/components/shared/form-input/form-input.test.js @@ -1,14 +1,18 @@ import { render, screen } from '@testing-library/react' import FormInput from './form-input' -test('Renders a FormInput with required props only', () => { - const props = { - label: 'Test', - type: 'text', - control: 'test', - onInputChange: () => {} - } - render() - const element = screen.getByText(props.label) - expect(element).toBeInTheDocument() +describe('[FormInput]', () => { + describe('[HAPPY PATH]', () => { + test('Renders with required props only', () => { + const props = { + label: 'Test', + type: 'text', + control: 'test', + onInputChange: () => {} + } + render() + const element = screen.getByText(props.label) + expect(element).toBeInTheDocument() + }) + }) }) diff --git a/src/components/shared/grid-layout/grid-layout.test.js b/src/components/shared/grid-layout/grid-layout.test.js index c64ea251..474bb574 100644 --- a/src/components/shared/grid-layout/grid-layout.test.js +++ b/src/components/shared/grid-layout/grid-layout.test.js @@ -1,8 +1,12 @@ import { render, screen } from '@testing-library/react' import GridLayout from './grid-layout' -test('render a grid with required properties', () => { - render() - const element = screen.getByText('Test') - expect(element).toBeInTheDocument() +describe('[GridLayout]', () => { + describe('[HAPPY PATH]', () => { + test('Renders with required properties only', () => { + render() + const element = screen.getByText('Test') + expect(element).toBeInTheDocument() + }) + }) }) diff --git a/src/components/shared/title/title.test.js b/src/components/shared/title/title.test.js new file mode 100644 index 00000000..8c2cbaea --- /dev/null +++ b/src/components/shared/title/title.test.js @@ -0,0 +1,17 @@ +import { render, screen } from '@testing-library/react' +import Title from './title' + +describe('[Title]', () => { + describe('[HAPPY PATH]', () => { + test('Renders with required props only', () => { + const props = { + title: 'My', + subTitle: 'Test' + } + + render() + const element = screen.getByText(props.title) + expect(element).toBeInTheDocument() + }) + }) +}) diff --git a/src/components/users/new-user-form/new-user-form.test.js b/src/components/users/new-user-form/new-user-form.test.js index 165c257f..e237d636 100644 --- a/src/components/users/new-user-form/new-user-form.test.js +++ b/src/components/users/new-user-form/new-user-form.test.js @@ -3,12 +3,16 @@ import { MockedProvider } from '@apollo/client/testing' // COMPONENTS import NewUserForm from './new-user-form' -test(`Renders a 'New User' Form without props`, () => { - render( - <MockedProvider mocks={[]} addTypename={false}> - <NewUserForm /> - </MockedProvider> - ) - const element = screen.getByText('Password') - expect(element).toBeInTheDocument() +describe('[NewUserForm]', () => { + describe('[HAPPY PATH]', () => { + test(`Renders without props`, () => { + render( + <MockedProvider mocks={[]} addTypename={false}> + <NewUserForm /> + </MockedProvider> + ) + const element = screen.getByText('Password') + expect(element).toBeInTheDocument() + }) + }) }) diff --git a/src/components/users/update-password-form/update-password-form.jsx b/src/components/users/update-password-form/update-password-form.jsx index aff16083..50b4151b 100644 --- a/src/components/users/update-password-form/update-password-form.jsx +++ b/src/components/users/update-password-form/update-password-form.jsx @@ -6,7 +6,7 @@ import { UPDATE_PASS } from '../../../graphql/mutations' import GridLayout from '../../shared/grid-layout/grid-layout' import Form from '../../shared/form/form' // FORM CONFIG -import { header, inputs, updateButton, cancelButton } from './update-password-form.config.json' +import { header, inputs, updateButton, cancelButton } from './update-password.config.json' // FUNCTIONS import { encryptPass } from '../../../functions/encrypt' diff --git a/src/components/users/update-password-form/update-password-form.test.js b/src/components/users/update-password-form/update-password-form.test.js index a38480b0..60c9ccee 100644 --- a/src/components/users/update-password-form/update-password-form.test.js +++ b/src/components/users/update-password-form/update-password-form.test.js @@ -1,6 +1,8 @@ describe('[UpdatePasswordForm]', () => { - test('Dummy test only', () => { - const test = 3 - expect(test).toBe(3) + describe('[HAPPY PATH]', () => { + test('Dummy test only', () => { + const test = 3 + expect(test).toBe(3) + }) }) }) diff --git a/src/components/users/update-password-form/update-password-form.config.json b/src/components/users/update-password-form/update-password.config.json similarity index 100% rename from src/components/users/update-password-form/update-password-form.config.json rename to src/components/users/update-password-form/update-password.config.json diff --git a/src/components/users/update-user-form/update-user-form.test.js b/src/components/users/update-user-form/update-user-form.test.js index 171fef90..182a51ac 100644 --- a/src/components/users/update-user-form/update-user-form.test.js +++ b/src/components/users/update-user-form/update-user-form.test.js @@ -9,18 +9,22 @@ import UpdateUserForm from './update-user-form' // HELPER FUNCTIONS import { setLoggedUser } from '../../../functions/local-storage' -test(`Renders a 'Update User' Form without props`, () => { - setLoggedUser({ - name: 'Test', - lastName: 'Test' +describe('[UpdateUserForm]', () => { + describe('[HAPPY PATH]', () => { + test(`Renders without props`, () => { + setLoggedUser({ + name: 'Test', + lastName: 'Test' + }) + render( + <Provider store={createStore(store)}> + <MockedProvider mocks={[]} addTypename={false}> + <UpdateUserForm /> + </MockedProvider> + </Provider> + ) + const element = screen.getByText('Name') + expect(element).toBeInTheDocument() + }) }) - render( - <Provider store={createStore(store)}> - <MockedProvider mocks={[]} addTypename={false}> - <UpdateUserForm /> - </MockedProvider> - </Provider> - ) - const element = screen.getByText('Name') - expect(element).toBeInTheDocument() })