Skip to content

Commit 187900b

Browse files
Add some fixes for userContext and test server
1 parent 650b438 commit 187900b

File tree

9 files changed

+10
-48
lines changed

9 files changed

+10
-48
lines changed

.mocharc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ require:
99
- test/test.mocha.env
1010
reporter: mocha-multi-reporters
1111
reporter-option:
12-
- configFile=mocha-multi-reporters.json
12+
- configFile=mocha-multi-reporters.json

mocha-multi-reporters.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
"mochawesomeReporterOptions": {
77
"reportDir": "test_report/mochawesome"
88
}
9-
}
9+
}

test/end-to-end/emailverification.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ describe("SuperTokens Email Verification", function () {
330330
const title = await getTextByDataSupertokens(page, "headerTitle");
331331
assert.deepStrictEqual(title, "Email verification successful!");
332332
await submitForm(page);
333-
// Make sure to wait for status to update. Flakes in headless.
333+
// Make sure to wait for status to update. Flakes in headless.
334334
await new Promise((r) => setTimeout(r, 500));
335335
const logoutButton = await getLogoutButton(page);
336336
await Promise.all([logoutButton.click(), page.waitForNavigation({ waitUntil: "networkidle0" })]);

test/end-to-end/mfa.signin.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ describe("SuperTokens SignIn w/ MFA", function () {
8989
consoleLogs.push(log);
9090
}
9191
});
92-
92+
9393
consoleLogs = await clearBrowserCookiesWithoutAffectingConsole(page, []);
9494

9595
await page.evaluate(() => window.localStorage.removeItem("supertokens-passwordless-loginAttemptInfo"));
@@ -117,7 +117,7 @@ describe("SuperTokens SignIn w/ MFA", function () {
117117
...appConfig,
118118
mfaInfo: {
119119
requirements: ["otp-email"],
120-
}
120+
},
121121
});
122122

123123
await tryEmailPasswordSignUp(page, email);

test/end-to-end/oauth2provider.test.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,7 @@ import {
4343
setupCoreApp,
4444
setupST,
4545
} from "../helpers";
46-
import {
47-
TEST_CLIENT_BASE_URL,
48-
TEST_APPLICATION_SERVER_BASE_URL,
49-
SOMETHING_WENT_WRONG_ERROR,
50-
} from "../constants";
46+
import { TEST_CLIENT_BASE_URL, TEST_APPLICATION_SERVER_BASE_URL, SOMETHING_WENT_WRONG_ERROR } from "../constants";
5147

5248
// We do no thave to use a separate domain for the oauth2 client, since the way we are testing
5349
// the lib doesn't interact with the supertokens session handling.

test/end-to-end/resetpasswordusingtoken.test.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,7 @@
2020
/* https://github.com/babel/babel/issues/9849#issuecomment-487040428 */
2121
import regeneratorRuntime from "regenerator-runtime";
2222
import assert from "assert";
23-
import {
24-
EMAIL_EXISTS_API,
25-
RESET_PASSWORD_API,
26-
RESET_PASSWORD_TOKEN_API,
27-
TEST_CLIENT_BASE_URL,
28-
} from "../constants";
23+
import { EMAIL_EXISTS_API, RESET_PASSWORD_API, RESET_PASSWORD_TOKEN_API, TEST_CLIENT_BASE_URL } from "../constants";
2924
import {
3025
clearBrowserCookiesWithoutAffectingConsole,
3126
getInputAdornmentsError,

test/end-to-end/userContext.test.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,12 @@ import {
2323
clickOnProviderButton,
2424
waitForUrl,
2525
loginWithAuth0,
26-
loginWithAuth0,
27-
waitForUrl,
28-
setupBrowser,
2926
backendHook,
3027
setupCoreApp,
3128
setupST,
3229
screenshotOnFailure,
3330
} from "../helpers";
34-
import {
35-
TEST_CLIENT_BASE_URL,
36-
RESET_PASSWORD_TOKEN_API,
37-
RESET_PASSWORD_API,
38-
SIGN_IN_UP_API,
39-
} from "../constants";
31+
import { TEST_CLIENT_BASE_URL, RESET_PASSWORD_TOKEN_API, RESET_PASSWORD_API, SIGN_IN_UP_API } from "../constants";
4032
import assert from "assert";
4133

4234
// Run the tests in a DOM environment.

test/helpers.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -926,10 +926,7 @@ export async function backendHook(hookType) {
926926
);
927927
}
928928

929-
export async function setupCoreApp({
930-
appId,
931-
coreConfig,
932-
} = {}) {
929+
export async function setupCoreApp({ appId, coreConfig } = {}) {
933930
const response = await fetch(`${TEST_SERVER_BASE_URL}/test/setup/app`, {
934931
method: "POST",
935932
headers: new Headers([["content-type", "application/json"]]),

test/server/index.js

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -174,29 +174,11 @@ const formFields = (process.env.MIN_FIELDS && []) || [
174174
];
175175
initST();
176176

177-
app.use(
178-
cors({
179-
origin: websiteDomain,
180-
allowedHeaders: ["content-type", ...SuperTokens.getAllCORSHeaders()],
181-
methods: ["GET", "PUT", "POST", "DELETE"],
182-
credentials: true,
183-
})
184-
);
185-
186-
app.use(middleware());
187-
188-
app.get("/ping", async (req, res) => {
189-
res.send("success");
190-
});
191-
192177
/**
193178
* Create a core application and initialize ST with the required config
194179
* @returns URL for the new core application
195180
*/
196-
async function setupApp({
197-
appId,
198-
coreConfig,
199-
} = {}) {
181+
async function setupApp({ appId, coreConfig } = {}) {
200182
const coreAppUrl = await setupCoreApplication({ appId, coreConfig });
201183
console.log("Connection URI: " + coreAppUrl);
202184

0 commit comments

Comments
 (0)