diff options
Diffstat (limited to 'src/tests/components')
-rw-r--r-- | src/tests/components/FormListing.test.tsx | 24 | ||||
-rw-r--r-- | src/tests/components/HeaderBar.test.tsx | 10 | ||||
-rw-r--r-- | src/tests/components/OAuth2Button.test.tsx | 10 | ||||
-rw-r--r-- | src/tests/components/Tag.test.tsx | 12 |
4 files changed, 28 insertions, 28 deletions
diff --git a/src/tests/components/FormListing.test.tsx b/src/tests/components/FormListing.test.tsx index 0afe10c..ad76381 100644 --- a/src/tests/components/FormListing.test.tsx +++ b/src/tests/components/FormListing.test.tsx @@ -1,11 +1,11 @@ -import React from 'react'; -import { render } from '@testing-library/react'; -import '@testing-library/jest-dom/extend-expect'; +import React from "react"; +import { render } from "@testing-library/react"; +import "@testing-library/jest-dom/extend-expect"; import FormListing from "../../components/FormListing"; -import { BrowserRouter as Router } from 'react-router-dom'; -import { Form, FormFeatures } from '../../api/forms'; -import { QuestionType } from '../../api/question'; +import { BrowserRouter as Router } from "react-router-dom"; +import { Form, FormFeatures } from "../../api/forms"; +import { QuestionType } from "../../api/question"; const openFormListing: Form = { name: "Example form listing", @@ -20,7 +20,7 @@ const openFormListing: Form = { "data": {} } ] -} +}; const closedFormListing: Form = { name: "Example form listing", @@ -35,28 +35,28 @@ const closedFormListing: Form = { "data": {} } ] -} +}; -test('renders form listing with specified title', () => { +test("renders form listing with specified title", () => { const { getByText } = render(<Router><FormListing form={openFormListing} /></Router>); const formListing = getByText(/Example form listing/i); expect(formListing).toBeInTheDocument(); }); -test('renders form listing with specified description', () => { +test("renders form listing with specified description", () => { const { getByText } = render(<Router><FormListing form={openFormListing} /></Router>); const formListing = getByText(/My form listing/i); expect(formListing).toBeInTheDocument(); }); -test('renders form listing with background green colour for open', () => { +test("renders form listing with background green colour for open", () => { const { container } = render(<Router><FormListing form={openFormListing} /></Router>); const elem = container.querySelector("a"); const style = window.getComputedStyle(elem); expect(style.backgroundColor).toBe("rgb(67, 181, 129)"); }); -test('renders form listing with background dark colour for closed', () => { +test("renders form listing with background dark colour for closed", () => { const { container } = render(<Router><FormListing form={closedFormListing} /></Router>); const elem = container.querySelector("a"); const style = window.getComputedStyle(elem); diff --git a/src/tests/components/HeaderBar.test.tsx b/src/tests/components/HeaderBar.test.tsx index 6963859..9c232ad 100644 --- a/src/tests/components/HeaderBar.test.tsx +++ b/src/tests/components/HeaderBar.test.tsx @@ -1,15 +1,15 @@ -import React from 'react'; -import { render } from '@testing-library/react'; -import '@testing-library/jest-dom/extend-expect' +import React from "react"; +import { render } from "@testing-library/react"; +import "@testing-library/jest-dom/extend-expect"; import HeaderBar from "../../components/HeaderBar"; -test('renders header bar with title', () => { +test("renders header bar with title", () => { const { getByText } = render(<HeaderBar />); const formListing = getByText(/Python Discord Forms/i); expect(formListing).toBeInTheDocument(); }); -test('renders header bar with custom title', () => { +test("renders header bar with custom title", () => { const { getByText } = render(<HeaderBar title="Testing title"/>); const formListing = getByText(/Testing title/i); expect(formListing).toBeInTheDocument(); diff --git a/src/tests/components/OAuth2Button.test.tsx b/src/tests/components/OAuth2Button.test.tsx index 53875dc..f05159f 100644 --- a/src/tests/components/OAuth2Button.test.tsx +++ b/src/tests/components/OAuth2Button.test.tsx @@ -1,8 +1,8 @@ -import React from 'react'; -import { render } from '@testing-library/react'; +import React from "react"; +import { render } from "@testing-library/react"; import OAuth2Button from "../../components/OAuth2Button"; -test('renders oauth2 sign in button text', () => { +test("renders oauth2 sign in button text", () => { const { getByText } = render(<OAuth2Button />); const button = getByText(/Sign in with Discord/i); expect(button).toBeInTheDocument(); @@ -10,6 +10,6 @@ test('renders oauth2 sign in button text', () => { test("renders fontawesome discord icon", () => { const { container } = render(<OAuth2Button/>); - const icon = container.querySelector(`[data-icon="discord"]`) + const icon = container.querySelector("[data-icon=\"discord\"]"); expect(icon).toBeInTheDocument(); -}) +}); diff --git a/src/tests/components/Tag.test.tsx b/src/tests/components/Tag.test.tsx index 67f2a85..50b3b0e 100644 --- a/src/tests/components/Tag.test.tsx +++ b/src/tests/components/Tag.test.tsx @@ -1,28 +1,28 @@ -import React from 'react'; -import { render } from '@testing-library/react'; +import React from "react"; +import { render } from "@testing-library/react"; import Tag from "../../components/Tag"; -test('renders tag with specified text', () => { +test("renders tag with specified text", () => { const { getByText } = render(<Tag text="Test" color="#f0f0f0" />); const tag = getByText(/Test/i); expect(tag).toBeInTheDocument(); }); -test('renders tag with specified color', () => { +test("renders tag with specified color", () => { const { getByText } = render(<Tag text="Test" color="#f0f0f0" />); const tag = getByText(/Test/i); const style = window.getComputedStyle(tag); expect(style.backgroundColor).toBe("rgb(240, 240, 240)"); }); -test('renders tag with specified font size', () => { +test("renders tag with specified font size", () => { const { getByText } = render(<Tag text="Test" color="#f0f0f0" fontSize="2em" />); const tag = getByText(/Test/i); const style = window.getComputedStyle(tag); expect(style.fontSize).toBe("2em"); }); -test('defaults to 0.75em when no tag font size is passed', () => { +test("defaults to 0.75em when no tag font size is passed", () => { const { getByText } = render(<Tag text="Test" color="#f0f0f0" />); const tag = getByText(/Test/i); const style = window.getComputedStyle(tag); |