Skip to content

Commit

Permalink
fix: cicd tests (#887)
Browse files Browse the repository at this point in the history
  • Loading branch information
sattvikc authored Jul 16, 2024
1 parent 24b46c2 commit 251d80c
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 5 deletions.
11 changes: 11 additions & 0 deletions test/session.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,7 @@ describe(`session: ${printPath("[test/session.test.js]")}`, function () {
response2.antiCsrfToken,
true,
false,
SessionRecipe.getInstanceOrThrowError().config,
{}
);

Expand Down Expand Up @@ -812,6 +813,7 @@ describe(`session: ${printPath("[test/session.test.js]")}`, function () {
response2.antiCsrfToken,
true,
false,
SessionRecipe.getInstanceOrThrowError().config,
{}
);

Expand Down Expand Up @@ -897,6 +899,7 @@ describe(`session: ${printPath("[test/session.test.js]")}`, function () {
response.antiCsrfToken,
true,
false,
SessionRecipe.getInstanceOrThrowError().config,
{}
);
let verifyState3 = await ProcessState.getInstance().waitForEvent(PROCESS_STATE.CALLING_SERVICE_IN_VERIFY, 1500);
Expand All @@ -922,6 +925,7 @@ describe(`session: ${printPath("[test/session.test.js]")}`, function () {
response2.antiCsrfToken,
true,
false,
SessionRecipe.getInstanceOrThrowError().config,
{}
);
let verifyState = await ProcessState.getInstance().waitForEvent(PROCESS_STATE.CALLING_SERVICE_IN_VERIFY);
Expand All @@ -938,6 +942,7 @@ describe(`session: ${printPath("[test/session.test.js]")}`, function () {
response2.antiCsrfToken,
true,
false,
SessionRecipe.getInstanceOrThrowError().config,
{}
);
let verifyState2 = await ProcessState.getInstance().waitForEvent(PROCESS_STATE.CALLING_SERVICE_IN_VERIFY, 1000);
Expand Down Expand Up @@ -987,6 +992,7 @@ describe(`session: ${printPath("[test/session.test.js]")}`, function () {
response.antiCsrfToken,
true,
true,
SessionRecipe.getInstanceOrThrowError().config,
{}
);
assert(response2.session != undefined);
Expand All @@ -998,6 +1004,7 @@ describe(`session: ${printPath("[test/session.test.js]")}`, function () {
response.antiCsrfToken,
false,
true,
SessionRecipe.getInstanceOrThrowError().config,
{}
);
assert(response3.session != undefined);
Expand Down Expand Up @@ -1038,6 +1045,7 @@ describe(`session: ${printPath("[test/session.test.js]")}`, function () {
undefined,
false,
false,
SessionRecipe.getInstanceOrThrowError().config,
{}
);

Expand All @@ -1052,6 +1060,7 @@ describe(`session: ${printPath("[test/session.test.js]")}`, function () {
undefined,
true,
false,
SessionRecipe.getInstanceOrThrowError().config,
{}
);
throw new Error("should not have come here");
Expand Down Expand Up @@ -1579,6 +1588,7 @@ describe(`session: ${printPath("[test/session.test.js]")}`, function () {
undefined,
false,
true,
SessionRecipe.getInstanceOrThrowError().config,
{}
);
assert(response2.session != undefined);
Expand All @@ -1591,6 +1601,7 @@ describe(`session: ${printPath("[test/session.test.js]")}`, function () {
undefined,
true,
true,
SessionRecipe.getInstanceOrThrowError().config,
{}
);
assert(response3.session != undefined);
Expand Down
26 changes: 23 additions & 3 deletions test/sessionAccessTokenSigningKeyUpdate.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ describe(`sessionAccessTokenSigningKeyUpdate: ${printPath(
response.antiCsrfToken,
true,
false,
SessionRecipe.getInstanceOrThrowError().config,
{}
);

Expand All @@ -125,6 +126,7 @@ describe(`sessionAccessTokenSigningKeyUpdate: ${printPath(
response.antiCsrfToken,
true,
false,
SessionRecipe.getInstanceOrThrowError().config,
{}
);
} catch (err) {
Expand Down Expand Up @@ -169,6 +171,7 @@ describe(`sessionAccessTokenSigningKeyUpdate: ${printPath(
response2.antiCsrfToken,
true,
false,
SessionRecipe.getInstanceOrThrowError().config,
{}
);

Expand All @@ -192,7 +195,9 @@ describe(`sessionAccessTokenSigningKeyUpdate: ${printPath(
parseJWTWithoutSignatureVerification(response3.accessToken.token),
response2.antiCsrfToken,
true,
false
false,
SessionRecipe.getInstanceOrThrowError().config,
{}
);

assert.strictEqual(response4.accessToken, undefined);
Expand Down Expand Up @@ -263,6 +268,7 @@ describe(`sessionAccessTokenSigningKeyUpdate: ${printPath(
newSession.antiCsrfToken,
true,
false,
SessionRecipe.getInstanceOrThrowError().config,
{}
);

Expand All @@ -284,7 +290,9 @@ describe(`sessionAccessTokenSigningKeyUpdate: ${printPath(
parseJWTWithoutSignatureVerification(oldSession.accessToken.token),
oldSession.antiCsrfToken,
true,
false
false,
SessionRecipe.getInstanceOrThrowError().config,
{}
);

let verifyState = await ProcessState.getInstance().waitForEvent(
Expand Down Expand Up @@ -341,6 +349,7 @@ describe(`sessionAccessTokenSigningKeyUpdate: ${printPath(
response.antiCsrfToken,
true,
false,
SessionRecipe.getInstanceOrThrowError().config,
{}
);

Expand All @@ -361,6 +370,7 @@ describe(`sessionAccessTokenSigningKeyUpdate: ${printPath(
response2.antiCsrfToken,
true,
false,
SessionRecipe.getInstanceOrThrowError().config,
{}
);
// Old core versions should throw here because the signing key was updated
Expand Down Expand Up @@ -429,6 +439,7 @@ describe(`sessionAccessTokenSigningKeyUpdate: ${printPath(
response.antiCsrfToken,
true,
false,
SessionRecipe.getInstanceOrThrowError().config,
{}
);

Expand All @@ -450,7 +461,9 @@ describe(`sessionAccessTokenSigningKeyUpdate: ${printPath(
parseJWTWithoutSignatureVerification(response2.accessToken.token),
response2.antiCsrfToken,
true,
false
false,
SessionRecipe.getInstanceOrThrowError().config,
{}
);
} catch (err) {
if (err.type !== Session.Error.TRY_REFRESH_TOKEN) {
Expand Down Expand Up @@ -507,6 +520,7 @@ describe(`sessionAccessTokenSigningKeyUpdate: ${printPath(
session.antiCsrfToken,
true,
false,
SessionRecipe.getInstanceOrThrowError().config,
{}
);

Expand Down Expand Up @@ -536,6 +550,7 @@ describe(`sessionAccessTokenSigningKeyUpdate: ${printPath(
session.antiCsrfToken,
true,
false,
SessionRecipe.getInstanceOrThrowError().config,
{}
);

Expand Down Expand Up @@ -565,6 +580,7 @@ describe(`sessionAccessTokenSigningKeyUpdate: ${printPath(
session2.antiCsrfToken,
true,
false,
SessionRecipe.getInstanceOrThrowError().config,
{}
);

Expand All @@ -589,6 +605,7 @@ describe(`sessionAccessTokenSigningKeyUpdate: ${printPath(
session2.antiCsrfToken,
true,
false,
SessionRecipe.getInstanceOrThrowError().config,
{}
);

Expand All @@ -610,6 +627,7 @@ describe(`sessionAccessTokenSigningKeyUpdate: ${printPath(
session.antiCsrfToken,
true,
false,
SessionRecipe.getInstanceOrThrowError().config,
{}
);
fail();
Expand Down Expand Up @@ -673,6 +691,7 @@ describe(`sessionAccessTokenSigningKeyUpdate: ${printPath(
session.antiCsrfToken,
true,
false,
SessionRecipe.getInstanceOrThrowError().config,
{}
);

Expand All @@ -694,6 +713,7 @@ describe(`sessionAccessTokenSigningKeyUpdate: ${printPath(
session.antiCsrfToken,
true,
false,
SessionRecipe.getInstanceOrThrowError().config,
{}
);

Expand Down
2 changes: 1 addition & 1 deletion test/sessionExpress.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3263,7 +3263,7 @@ describe(`sessionExpress: ${printPath("[test/sessionExpress.test.js]")}`, functi
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
3 changes: 2 additions & 1 deletion test/thirdparty/tpConfigsForVerification.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ const privateKey =
"-----BEGIN PRIVATE KEY-----\nMIGTAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHkwdwIBAQQgu8gXs+XYkqXD6Ala9Sf/iJXzhbwcoG5dMh1OonpdJUmgCgYIKoZIzj0DAQehRANCAASfrvlFbFCYqn3I2zeknYXLwtH30JuOKestDbSfZYxZNMqhF/OzdZFTV0zc5u5s3eN+oCWbnvl0hM+9IW0UlkdA\n-----END PRIVATE KEY-----";
const configsForVerification = {
"active-directory": {
oidcDiscoveryEndpoint: "https://login.microsoftonline.com/97f9a564-fcee-4b88-ae34-a1fbc4656593/v2.0/",
oidcDiscoveryEndpoint:
"https://login.microsoftonline.com/97f9a564-fcee-4b88-ae34-a1fbc4656593/v2.0/.well-known/openid-configuration",
scope: ["openid", "email"],
authorizationEndpoint:
"https://login.microsoftonline.com/97f9a564-fcee-4b88-ae34-a1fbc4656593/oauth2/v2.0/authorize",
Expand Down

0 comments on commit 251d80c

Please sign in to comment.