Files
t3code/apps/web/src/cloud/desktopAuth.test.ts
T

60 lines
1.5 KiB
TypeScript

import { describe, expect, it } from "vite-plus/test";
import { resolveDesktopCloudAuthOAuthOptions } from "./desktopAuth";
describe("resolveDesktopCloudAuthOAuthOptions", () => {
it("ignores absent social provider settings", () => {
expect(
resolveDesktopCloudAuthOAuthOptions({
environment: {
userSettings: {
social: {
github: null,
google: {
strategy: "oauth_google",
enabled: true,
authenticatable: true,
},
},
},
},
}),
).toEqual([
{
strategy: "oauth_google",
label: "Google",
providerId: "google",
iconUrl: null,
},
]);
});
it("preserves provider display metadata when Clerk exposes the strategy list", () => {
expect(
resolveDesktopCloudAuthOAuthOptions({
environment: {
userSettings: {
authenticatableSocialStrategies: ["oauth_google"],
social: {
oauth_google: {
strategy: "oauth_google",
enabled: true,
authenticatable: true,
name: "Google",
logo_url: "https://img.clerk.com/static/google.png",
},
},
},
},
}),
).toEqual([
{
strategy: "oauth_google",
label: "Google",
providerId: "google",
iconUrl: "https://img.clerk.com/static/google.png",
},
]);
});
});