From 9a85a3a8bdd96ad7d0be91fef98bef3dfa84895a Mon Sep 17 00:00:00 2001 From: Chakravarthi Medicharla Date: Mon, 25 Sep 2023 18:43:34 +0530 Subject: [PATCH] test: custom icons for custom thirdparty providers --- .../unit/recipe/thirdparty/thirdParty.test.ts | 25 +++++++++++++++++++ test/with-typescript/src/App.tsx | 11 ++++++++ 2 files changed, 36 insertions(+) diff --git a/test/unit/recipe/thirdparty/thirdParty.test.ts b/test/unit/recipe/thirdparty/thirdParty.test.ts index c9720ac77..e77f8fa4e 100644 --- a/test/unit/recipe/thirdparty/thirdParty.test.ts +++ b/test/unit/recipe/thirdparty/thirdParty.test.ts @@ -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: { diff --git a/test/with-typescript/src/App.tsx b/test/with-typescript/src/App.tsx index 5a3113718..65b0a3a5d 100644 --- a/test/with-typescript/src/App.tsx +++ b/test/with-typescript/src/App.tsx @@ -453,6 +453,12 @@ function getThirdPartyConfigs() { name: "Custom", buttonComponent: ASDF Custom, }, + { + id: "custom-2", + name: "Custom-2", + logo: , + buttonComponent: ASDF Custom, + }, ], }, oAuthCallbackScreen: { @@ -493,6 +499,11 @@ function getThirdPartyEmailPasswordConfigs() { { id: "custom", name: "Custom", + logo: , + }, + { + id: "custom-2", + name: "Custom-2", }, ], },