diff options
author | 2021-03-07 18:48:43 +0200 | |
---|---|---|
committer | 2021-03-07 18:48:43 +0200 | |
commit | 11151894702fab1a06e3dfe9eca43d4596b5290e (patch) | |
tree | c74483bd5327751ef54a486d7bdcf20eed418919 /src/tests | |
parent | Add margin to bottom of captcha (diff) | |
parent | Renables OAuth Button On Failure (diff) |
Merge branch 'main' into hcaptcha
Diffstat (limited to 'src/tests')
-rw-r--r-- | src/tests/components/OAuth2Button.test.tsx | 2 | ||||
-rw-r--r-- | src/tests/pages/CallbackPage.test.tsx | 15 |
2 files changed, 8 insertions, 9 deletions
diff --git a/src/tests/components/OAuth2Button.test.tsx b/src/tests/components/OAuth2Button.test.tsx index f05159f..a773686 100644 --- a/src/tests/components/OAuth2Button.test.tsx +++ b/src/tests/components/OAuth2Button.test.tsx @@ -4,7 +4,7 @@ import OAuth2Button from "../../components/OAuth2Button"; test("renders oauth2 sign in button text", () => { const { getByText } = render(<OAuth2Button />); - const button = getByText(/Sign in with Discord/i); + const button = getByText(/Discord Login/i); expect(button).toBeInTheDocument(); }); diff --git a/src/tests/pages/CallbackPage.test.tsx b/src/tests/pages/CallbackPage.test.tsx index 9049ca3..70f2fed 100644 --- a/src/tests/pages/CallbackPage.test.tsx +++ b/src/tests/pages/CallbackPage.test.tsx @@ -3,21 +3,20 @@ import { render } from "@testing-library/react"; import CallbackPage from "../../pages/CallbackPage"; -test("callback page renders provided code", () => { +test("callback page sends provided code", () => { global.opener = { postMessage: jest.fn() }; - const mockLocation = new URL("https://forms.pythondiscord.com/authorize?code=abcdef"); + const mockLocation = new URL("https://forms.pythondiscord.com/authorize?code=abcde_code&state=abcde_state"); Object.defineProperty(global, "location", {value: mockLocation}); - const comp = <CallbackPage />; + render(<CallbackPage/>); - const { getByText } = render(comp); - - - const codeText = getByText(/Code is abcdef/); - expect(codeText).toBeInTheDocument(); expect(global.opener.postMessage).toBeCalledTimes(1); + expect(global.opener.postMessage).toBeCalledWith({ + code: "abcde_code", + state: "abcde_state" + }); }); |