aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/pages/CallbackPage.test.tsx
diff options
context:
space:
mode:
authorGravatar Joe Banks <[email protected]>2020-10-12 17:56:49 +0100
committerGravatar Joe Banks <[email protected]>2020-10-12 17:56:49 +0100
commit3adfb0db3493a55276b126bdbcb343da89218601 (patch)
treee65af73279eb7a4379652d8d664cbfd2e6a9880c /src/tests/pages/CallbackPage.test.tsx
parentMerge pull request #24 from python-discord/sentry/remove-tracing (diff)
Add many new tests
Diffstat (limited to 'src/tests/pages/CallbackPage.test.tsx')
-rw-r--r--src/tests/pages/CallbackPage.test.tsx23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/tests/pages/CallbackPage.test.tsx b/src/tests/pages/CallbackPage.test.tsx
new file mode 100644
index 0000000..e878577
--- /dev/null
+++ b/src/tests/pages/CallbackPage.test.tsx
@@ -0,0 +1,23 @@
+import React from 'react';
+import { render } from '@testing-library/react';
+
+import CallbackPage from '../../pages/CallbackPage';
+
+test('callback page renders provided code', () => {
+ global.opener = {
+ postMessage: jest.fn()
+ }
+
+ let mockLocation = new URL("https://forms.pythondiscord.com/authorize?code=abcdef");
+
+ Object.defineProperty(global, "location", {value: mockLocation})
+
+ let comp = <CallbackPage />;
+
+ const { getByText } = render(comp);
+
+
+ let codeText = getByText(/Code is abcdef/);
+ expect(codeText).toBeInTheDocument();
+ expect(global.opener.postMessage).toBeCalledTimes(1)
+});