Skip to content

Commit

Permalink
fix: cicd tests (#886)
Browse files Browse the repository at this point in the history
  • Loading branch information
sattvikc authored Jul 16, 2024
1 parent 50f3f07 commit ddd5f9a
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 9 deletions.
3 changes: 2 additions & 1 deletion lib/build/recipe/dashboard/api/multitenancy/deleteTenant.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ async function deleteTenant(_, tenantId, __, userContext) {
const deleteTenantRes = await multitenancy_1.default.deleteTenant(tenantId, userContext);
return deleteTenantRes;
} catch (err) {
if (err.statusCodeFromCore === 403 && err.errorMessageFromCore.includes("Cannot delete public tenant")) {
const errMsg = err.message;
if (errMsg.includes("SuperTokens core threw an error for a ") && errMsg.includes("with status code: 403")) {
return {
status: "CANNOT_DELETE_PUBLIC_TENANT_ERROR",
};
Expand Down
3 changes: 2 additions & 1 deletion lib/ts/recipe/dashboard/api/multitenancy/deleteTenant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ export default async function deleteTenant(

return deleteTenantRes;
} catch (err) {
if (err.statusCodeFromCore === 403 && err.errorMessageFromCore.includes("Cannot delete public tenant")) {
const errMsg: string = err.message;
if (errMsg.includes("SuperTokens core threw an error for a ") && errMsg.includes("with status code: 403")) {
return {
status: "CANNOT_DELETE_PUBLIC_TENANT_ERROR",
};
Expand Down
2 changes: 1 addition & 1 deletion test/auth-react-server/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ module.exports.startST = async function (config = {}) {
};

module.exports.removeAppAndTenants = async function (host, port, appId) {
const tenantsResp = await fetch(`http://${host}:${port}/appid-${appId}/recipe/multitenancy/tenant/list`);
const tenantsResp = await fetch(`http://${host}:${port}/appid-${appId}/recipe/multitenancy/tenant/list/v2`);
if (tenantsResp.status === 401) {
const updateAppResp = await fetch(`http://${host}:${port}/recipe/multitenancy/app/v2`, {
method: "PUT",
Expand Down
3 changes: 2 additions & 1 deletion test/dashboard/createOrUpdateThirdPartyConfig.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ describe(`User Dashboard createOrUpdateThirdPartyConfig: ${printPath(
firstFactors: ["emailpassword", "thirdparty"],
});

const createThirdPartyConfigURL = `/auth/${tenantName}/dashboard/api/tenants/third-party`;
const createThirdPartyConfigURL = `/auth/${tenantName}/dashboard/api/thirdparty/config`;

let thirdPartyConfigResponse = await new Promise((res) => {
request(app)
Expand All @@ -96,6 +96,7 @@ describe(`User Dashboard createOrUpdateThirdPartyConfig: ${printPath(
console.log(err);
res(undefined);
} else {
console.log(response.text);
res(JSON.parse(response.text));
}
});
Expand Down
4 changes: 2 additions & 2 deletions test/dashboard/deleteThirdPartyConfig.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ describe(`User Dashboard deleteThirdPartyConfig: ${printPath(
],
});

const deleteThirdPartyConfigURL = `/auth/${tenantName}/dashboard/api/tenants/third-party?thirdPartyId=google`;
const deleteThirdPartyConfigURL = `/auth/${tenantName}/dashboard/api/thirdparty/config?thirdPartyId=google`;

let tenantInfoResponse = await new Promise((res) => {
request(app)
Expand Down Expand Up @@ -128,7 +128,7 @@ describe(`User Dashboard deleteThirdPartyConfig: ${printPath(

app.use(errorHandler());

const deleteThirdPartyConfigURL = `/auth/dashboard/api/tenants/third-party`;
const deleteThirdPartyConfigURL = `/auth/dashboard/api/thirdparty/config`;

let responseStatus = 200;
let deleteThirdPartyConfigResponse = await new Promise((res) => {
Expand Down
2 changes: 1 addition & 1 deletion test/emailpassword/emailverify.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1441,7 +1441,7 @@ describe(`emailverify: ${printPath("[test/emailpassword/emailverify.test.js]")}`
appInfo: {
apiDomain: "api.supertokens.io",
appName: "SuperTokens",
origin: ({ userContext }) => userContext.url,
origin: ({ userContext }) => userContext.url || "http://localhost:1234",
},
recipeList: [
EmailPassword.init(),
Expand Down
2 changes: 1 addition & 1 deletion test/emailpassword/passwordreset.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,7 @@ describe(`passwordreset: ${printPath("[test/emailpassword/passwordreset.test.js]
apiDomain: "api.supertokens.io",
appName: "SuperTokens",
origin: ({ request }) => {
if (request.getHeaderValue("origin") !== undefined) {
if (request !== undefined && request.getHeaderValue("origin") !== undefined) {
return request.getHeaderValue("origin");
}

Expand Down
2 changes: 1 addition & 1 deletion test/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ module.exports.startSTWithMultitenancyAndAccountLinking = async function (config
};

module.exports.removeAppAndTenants = async function (appId) {
const tenantsResp = await fetch(`http://localhost:8080/appid-${appId}/recipe/multitenancy/tenant/list`);
const tenantsResp = await fetch(`http://localhost:8080/appid-${appId}/recipe/multitenancy/tenant/list/v2`);
if (tenantsResp.status === 401) {
const updateAppResp = await fetch(`http://localhost:8080/recipe/multitenancy/app/v2`, {
method: "PUT",
Expand Down

0 comments on commit ddd5f9a

Please sign in to comment.