aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/pages/LandingPage.test.tsx
diff options
context:
space:
mode:
authorGravatar Joe Banks <[email protected]>2020-12-14 19:18:19 +0000
committerGravatar GitHub <[email protected]>2020-12-14 19:18:19 +0000
commita1963eb56f9682a6315a06a075d09314822dbfd9 (patch)
treed0856e1326516447a33951de623770787f6ef996 /src/tests/pages/LandingPage.test.tsx
parentMerge pull request #29 from python-discord/dependabot/npm_and_yarn/ini-1.3.8 (diff)
parentSimplify Axios client baseURL definition (diff)
Merge pull request #30 from python-discord/ks123/discovery
Diffstat (limited to 'src/tests/pages/LandingPage.test.tsx')
-rw-r--r--src/tests/pages/LandingPage.test.tsx21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/tests/pages/LandingPage.test.tsx b/src/tests/pages/LandingPage.test.tsx
index ba32bab..23195bd 100644
--- a/src/tests/pages/LandingPage.test.tsx
+++ b/src/tests/pages/LandingPage.test.tsx
@@ -2,10 +2,31 @@ import React from 'react';
import { render } from '@testing-library/react';
import LandingPage from "../../pages/LandingPage";
+import * as forms from "../../api/forms";
import { BrowserRouter as Router } from "react-router-dom";
+import { QuestionType } from '../../api/question';
+
+const testingForm: forms.Form = {
+ "id": "testing-form",
+ "name": "Testing Form",
+ "description": "Meant for testing",
+ "features": [forms.FormFeatures.Discoverable],
+ "questions": [
+ {
+ "id": "my-question",
+ "name": "My Question",
+ "type": QuestionType.ShortText,
+ "data": {}
+ }
+ ]
+}
test('renders landing page', () => {
+ const setForms = jest.fn(() => [testingForm]);
+ Object.defineProperty(forms, "getForms", setForms);
+ const handleForms = jest.spyOn(React, "useState");
+ handleForms.mockImplementation(_value => [[testingForm], setForms]);
const { getByText } = render(<Router><LandingPage /></Router>);
// If we rendered the headerbar we rendered the landing page.
let headerBar = getByText(/Python Discord Forms/);