Skip to content

Commit

Permalink
test: update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
porcellus committed Jul 28, 2024
1 parent a463b65 commit b0984c1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions test/config.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ describe(`configTest: ${printPath("[test/config.test.js]")}`, function () {
recipeList: [Session.init({ getTokenTransferMethod: () => "cookie" })],
});
SessionRecipe.getInstanceOrThrowError();
assert.strictEqual(SuperTokens.getInstanceOrThrowError().recipeModules.length, 3); // multitenancy&usermetadata is initialised by default
assert.strictEqual(SuperTokens.getInstanceOrThrowError().recipeModules.length, 4); // multitenancy&usermetadata&oauth2provider is initialised by default
resetAll();
}

Expand All @@ -252,7 +252,7 @@ describe(`configTest: ${printPath("[test/config.test.js]")}`, function () {
});
SessionRecipe.getInstanceOrThrowError();
EmailPasswordRecipe.getInstanceOrThrowError();
assert(SuperTokens.getInstanceOrThrowError().recipeModules.length === 4); // multitenancy&usermetadata is initialised by default
assert(SuperTokens.getInstanceOrThrowError().recipeModules.length === 5); // multitenancy&usermetadata&oauth2provider is initialised by default
resetAll();
}
});
Expand Down
7 changes: 6 additions & 1 deletion test/jwt/getJWKS.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,12 @@ describe(`getJWKS: ${printPath("[test/jwt/getJWKS.test.js]")}`, function () {
assert(Object.keys(response).length === 1);
assert(response.keys !== undefined);
assert(response.keys.length > 0);
assert.strictEqual(headers["cache-control"], "max-age=60, must-revalidate");
const cacheControlHeaderParts = headers["cache-control"].split(", ");
assert.strictEqual(cacheControlHeaderParts.length, 2);
assert(cacheControlHeaderParts[0].startsWith("max-age=60"));
const maxAge = Number.parseInt(cacheControlHeaderParts[0].split("=")[1]);
assert(maxAge >= 60);
assert.strictEqual(cacheControlHeaderParts[1], "must-revalidate");
});

it("Test that we can override the Cache-Control header through the function", async function () {
Expand Down
6 changes: 3 additions & 3 deletions test/oauth2/config.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ let assert = require("assert");
const { printPath, setupST, startST, killAllST, cleanST } = require("../utils");
let { ProcessState } = require("../../lib/build/processState");
let STExpress = require("../../");
const OAuth2Recipe = require("../../lib/build/recipe/oauth2/recipe").default;
const OAuth2ProviderRecipe = require("../../lib/build/recipe/oauth2provider/recipe").default;
let { Querier } = require("../../lib/build/querier");
const { maxVersion } = require("../../lib/build/utils");

Expand All @@ -30,7 +30,7 @@ describe(`configTest: ${printPath("[test/oauth2/config.test.js]")}`, function ()
appName: "SuperTokens",
websiteDomain: "supertokens.io",
},
recipeList: [OAuth2Recipe.init()],
recipeList: [OAuth2ProviderRecipe.init()],
});

// Only run for version >= 2.9
Expand All @@ -40,6 +40,6 @@ describe(`configTest: ${printPath("[test/oauth2/config.test.js]")}`, function ()
return;
}

OAuth2Recipe.getInstanceOrThrowError();
OAuth2ProviderRecipe.getInstanceOrThrowError();
});
});

0 comments on commit b0984c1

Please sign in to comment.