Skip to content

Commit

Permalink
test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
niftyvictor committed Feb 14, 2025
1 parent e1655f9 commit cc3d449
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
19 changes: 10 additions & 9 deletions test/webauthn/apis.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ describe(`apisFunctions: ${printPath("[test/webauthn/apis.test.js]")}`, function
userContext: {},
});

assert.equal(generatedOptions.origin, "https://supertokens.io");
assert.equal(generatedOptions.origin, "https://api.supertokens.io");
});

it("test registerOptions with custom values", async function () {
Expand All @@ -106,10 +106,10 @@ describe(`apisFunctions: ${printPath("[test/webauthn/apis.test.js]")}`, function
recipeList: [
WebAuthn.init({
getOrigin: () => {
return "testOrigin.com";
return "https://test.testId.com";
},
getRelyingPartyId: () => {
return "testId.com";
return "testOrigin.com"; // this should be ignored
},
getRelyingPartyName: () => {
return "testName";
Expand Down Expand Up @@ -181,7 +181,7 @@ describe(`apisFunctions: ${printPath("[test/webauthn/apis.test.js]")}`, function
userContext: {},
});

assert.equal(generatedOptions.origin, "testOrigin.com");
assert.equal(generatedOptions.origin, "https://test.testId.com");
assert.equal(generatedOptions.userPresence, false);
});
});
Expand Down Expand Up @@ -227,7 +227,7 @@ describe(`apisFunctions: ${printPath("[test/webauthn/apis.test.js]")}`, function
});

assert.equal(generatedOptions.relyingPartyId, "api.supertokens.io");
assert.equal(generatedOptions.origin, "https://supertokens.io");
assert.equal(generatedOptions.origin, "https://api.supertokens.io");
});

it("test signInOptions with custom values", async function () {
Expand All @@ -245,10 +245,10 @@ describe(`apisFunctions: ${printPath("[test/webauthn/apis.test.js]")}`, function
recipeList: [
WebAuthn.init({
getOrigin: () => {
return "testOrigin.com";
return "https://test.testOrigin.com";
},
getRelyingPartyId: () => {
return "testId.com";
return "testOrigin.com"; // this should be ignored
},
getRelyingPartyName: () => {
return "testName";
Expand Down Expand Up @@ -294,8 +294,8 @@ describe(`apisFunctions: ${printPath("[test/webauthn/apis.test.js]")}`, function
userContext: {},
});

assert.equal(generatedOptions.relyingPartyId, "testId.com");
assert.equal(generatedOptions.origin, "testOrigin.com");
assert.equal(generatedOptions.relyingPartyId, "testOrigin.com");
assert.equal(generatedOptions.origin, "https://test.testOrigin.com");
});
});

Expand Down Expand Up @@ -568,6 +568,7 @@ describe(`apisFunctions: ${printPath("[test/webauthn/apis.test.js]")}`, function
});

it("should fail signIn if there is no credential registered for the user", async function () {});

it("should allow signIn multiple times with the same credential", async function () {});
});

Expand Down
6 changes: 5 additions & 1 deletion test/webauthn/lib/initST.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ const initST = async ({
return origin;
},
}
: {}),
: {
getOrigin: async () => {
return "https://api.supertokens.io"; // set it like this because the default value would actually use the origin and it would not match the default relying party id
},
}),
...(rpId
? {
getRelyingPartyId: async () => {
Expand Down

0 comments on commit cc3d449

Please sign in to comment.