Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bundle/emailpassword.c7fc939a51dd7f5ff76c.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion bundle/emailpassword.ede00ef1630bafb2eeb0.js

This file was deleted.

1 change: 1 addition & 0 deletions bundle/emailverification.262fec6ec42dfbee99ef.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion bundle/emailverification.ff4d74e887d3f6973489.js

This file was deleted.

1 change: 1 addition & 0 deletions bundle/multifactorauth.01bccc62c8e1dacf77a2.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion bundle/multifactorauth.b8125e2a9fad618075c6.js

This file was deleted.

1 change: 0 additions & 1 deletion bundle/multitenancy.caf13556110682f34f33.js

This file was deleted.

1 change: 1 addition & 0 deletions bundle/multitenancy.fbdfd29d693bccc48b1c.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions bundle/oauth2provider.e0919529c333777ca971.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion bundle/oauth2provider.fc92b1418941c4e963ec.js

This file was deleted.

1 change: 0 additions & 1 deletion bundle/passwordless.490c53ee69a14fd56f55.js

This file was deleted.

1 change: 1 addition & 0 deletions bundle/passwordless.ae05a715e7f35a4d10ff.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion bundle/supertokens.24346da192ec086ac103.js

This file was deleted.

1 change: 1 addition & 0 deletions bundle/supertokens.a899e2edc82b5abfa073.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions bundle/thirdparty.48645242d76a18802f0d.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion bundle/thirdparty.a125dc86eec971bffa87.js

This file was deleted.

1 change: 0 additions & 1 deletion bundle/totp.973bd1ac57fc8476148c.js

This file was deleted.

1 change: 1 addition & 0 deletions bundle/totp.f18bcd724044330f2c27.js

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions lib/build/querier.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions lib/ts/querier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ export default class Querier {
}

populated = new NormalisedURLPath(populated).getAsStringDangerous();

// If the `params` are empty, we can return the populated path
if (Object.keys(queryParams).length === 0) {
return populated;
}

// Create a new URLSearchParams object with the query params and add it to the path
const searchParams = new URLSearchParams(queryParams);
populated += "?" + searchParams.toString();
Expand Down
126 changes: 120 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"@babel/preset-env": "^7.16.11",
"@babel/register": "^7.17.7",
"@size-limit/preset-small-lib": "^8.1.0",
"isomorphic-fetch": "^3.0.0",
"madge": "^5.0.1",
"mocha": "^9.2.2",
"mocha-jsdom": "^2.0.0",
Expand Down
21 changes: 21 additions & 0 deletions test/constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.
*
* This software is licensed under the Apache License, Version 2.0 (the
* "License") as published by the Apache Software Foundation.
*
* You may not use this file except in compliance with the License. You may
* obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/

/*
* Consts.
*/
export const TEST_SERVER_BASE_URL = "http://localhost:8082";
export const TEST_APPLICATION_SERVER_BASE_URL =
"http://localhost:" + (process.env.APP_SERVER === undefined ? "8082" : process.env.APP_SERVER);
80 changes: 80 additions & 0 deletions test/helpers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.
*
* This software is licensed under the Apache License, Version 2.0 (the
* "License") as published by the Apache Software Foundation.
*
* You may not use this file except in compliance with the License. You may
* obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/

/*
* Imports.
*/
import fetch from "isomorphic-fetch";
import { TEST_APPLICATION_SERVER_BASE_URL, TEST_SERVER_BASE_URL } from "./constants";

export function getTestEmail(post) {
return `john.doe+${Date.now()}-${post ?? "0"}@supertokens.io`;
}

export async function backendHook(hookType) {
const serverUrls = Array.from(new Set([TEST_SERVER_BASE_URL, TEST_APPLICATION_SERVER_BASE_URL]));

await Promise.all(
serverUrls.map((url) => fetch(`${url}/test/${hookType}`, { method: "POST" }).catch(console.error))
);
}

export async function setupCoreApp({ appId, coreConfig } = {}) {
const response = await fetch(`${TEST_SERVER_BASE_URL}/test/setup/app`, {
method: "POST",
headers: new Headers([["content-type", "application/json"]]),
body: JSON.stringify({
appId,
coreConfig,
}),
});

return await response.text();
}

export async function setupST({
coreUrl,
accountLinkingConfig = {},
enabledRecipes,
enabledProviders,
passwordlessFlowType,
passwordlessContactMethod,
mfaInfo = {},
} = {}) {
await fetch(`${TEST_APPLICATION_SERVER_BASE_URL}/test/setup/st`, {
method: "POST",
headers: new Headers([["content-type", "application/json"]]),
body: JSON.stringify({
coreUrl,
accountLinkingConfig,
enabledRecipes,
enabledProviders,
passwordlessFlowType,
passwordlessContactMethod,
mfaInfo,
}),
});
}

export async function backendBeforeEach() {
await fetch(`${TEST_SERVER_BASE_URL}/beforeeach`, {
method: "POST",
}).catch(console.error);
if (TEST_SERVER_BASE_URL !== TEST_APPLICATION_SERVER_BASE_URL) {
await fetch(`${TEST_APPLICATION_SERVER_BASE_URL}/beforeeach`, {
method: "POST",
}).catch(console.error);
}
}
Loading