Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Chakravarthy7102 committed Sep 25, 2023
1 parent a76a38e commit bb640d8
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
25 changes: 25 additions & 0 deletions test/unit/recipe/thirdparty/thirdParty.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,31 @@ describe("ThirdParty", function () {
);
});

it("Initializing ThirdParty with custom provider and custom logo if provided", async function () {
ThirdParty.init({
signInAndUpFeature: {
providers: [
{
id: "slack",
name: "Slack",
logo: "LOGO" as any,
},
],
},
}).authReact(SuperTokens.getInstanceOrThrow().appInfo, false);
assert.notDeepStrictEqual(ThirdParty.getInstanceOrThrow(), undefined);
assert.deepStrictEqual(ThirdParty.getInstanceOrThrow().config.recipeId, "thirdparty");
assert.deepStrictEqual(
ThirdParty.getInstanceOrThrow().config.appInfo,
SuperTokens.getInstanceOrThrow().appInfo
);
assert.deepStrictEqual(ThirdParty.getInstanceOrThrow().config.signInAndUpFeature.providers.length, 1);
assert.deepStrictEqual(
ThirdParty.getInstanceOrThrow().config.signInAndUpFeature.providers[0].getLogo(),
"LOGO"
);
});

it("Initializing ThirdParty with Google twice only shows a warning and filters duplicate", async function () {
ThirdParty.init({
signInAndUpFeature: {
Expand Down
11 changes: 11 additions & 0 deletions test/with-typescript/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,12 @@ function getThirdPartyConfigs() {
name: "Custom",
buttonComponent: <span>ASDF Custom</span>,
},
{
id: "custom-2",
name: "Custom-2",
logo: <svg></svg>,
buttonComponent: <span>ASDF Custom</span>,
},
],
},
oAuthCallbackScreen: {
Expand Down Expand Up @@ -493,6 +499,11 @@ function getThirdPartyEmailPasswordConfigs() {
{
id: "custom",
name: "Custom",
logo: <svg></svg>,
},
{
id: "custom-2",
name: "Custom-2",
},
],
},
Expand Down

0 comments on commit bb640d8

Please sign in to comment.