From ebd3198d23def3d74d3aa30f4d0e575b9487236b Mon Sep 17 00:00:00 2001 From: Liam Stevens <8955671+liamstevens111@users.noreply.github.com> Date: Wed, 15 Feb 2023 10:24:24 +0700 Subject: [PATCH] [#7] Add tests for Button and cleanup --- cypress/tsconfig.json | 2 +- src/components/Button/index.test.tsx | 33 ++++++++++++++++++++++++++++ src/components/Button/index.tsx | 2 +- src/screens/Home/index.test.tsx | 4 +--- src/screens/Home/login.tsx | 26 ++++++++++------------ 5 files changed, 48 insertions(+), 19 deletions(-) create mode 100644 src/components/Button/index.test.tsx diff --git a/cypress/tsconfig.json b/cypress/tsconfig.json index d02ddfd..a943f82 100644 --- a/cypress/tsconfig.json +++ b/cypress/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "target": "es5", + "target": "es6", "lib": ["es5", "dom"], "types": ["node", "cypress", "@testing-library/cypress"], "moduleResolution": "node", diff --git a/src/components/Button/index.test.tsx b/src/components/Button/index.test.tsx new file mode 100644 index 0000000..282ab06 --- /dev/null +++ b/src/components/Button/index.test.tsx @@ -0,0 +1,33 @@ +import { render, screen } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; + +import Button from '.'; + +const handleButtonClick = jest.fn(); + +describe('Button', () => { + test('renders a button on the page', () => { + render(