Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[React SDK] Fix: Hides custom_jwt profiles from UI #5802

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,6 @@ describe("LinkedProfilesScreen", () => {
expect(screen.getByText("[email protected]")).toBeInTheDocument();
});

it("should display Custom Profile for custom_auth_endpoint", () => {
vi.mocked(useProfiles).mockReturnValue({
data: [{ type: "Custom_auth_endpoint", details: {} }],
isLoading: false,
// biome-ignore lint/suspicious/noExplicitAny: Mocking data
} as any);

render(<LinkedProfilesScreen {...mockProps} />);
expect(screen.getByText("Custom Profile")).toBeInTheDocument();
});

it("should capitalize unknown profile types", () => {
vi.mocked(useProfiles).mockReturnValue({
data: [{ type: "unknown", details: {} }],
Expand Down Expand Up @@ -156,5 +145,33 @@ describe("LinkedProfilesScreen", () => {
render(<LinkedProfilesScreen {...mockProps} />);
expect(screen.queryByLabelText("Unlink")).not.toBeInTheDocument();
});

it("should not display custom_jwt profiles", () => {
vi.mocked(useProfiles).mockReturnValue({
data: [{ type: "custom_jwt", details: {} }],
isLoading: false,
// biome-ignore lint/suspicious/noExplicitAny: Mocking data
} as any);

render(<LinkedProfilesScreen {...mockProps} />);
expect(screen.queryByText("Custom_jwt")).not.toBeInTheDocument();
});

it("should display profiles that are not guest or custom_jwt", () => {
vi.mocked(useProfiles).mockReturnValue({
data: [
{ type: "email", details: { email: "[email protected]" } },
{ type: "custom_jwt", details: {} },
{ type: "guest", details: {} },
],
isLoading: false,
// biome-ignore lint/suspicious/noExplicitAny: Mocking data
} as any);

render(<LinkedProfilesScreen {...mockProps} />);
expect(screen.getByText("[email protected]")).toBeInTheDocument();
expect(screen.queryByText("Custom_jwt")).not.toBeInTheDocument();
expect(screen.queryByText("Guest")).not.toBeInTheDocument();
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,12 @@ export function LinkedProfilesScreen(props: {
<Spacer y="xs" />
{/* Exclude guest as a profile */}
{connectedProfiles
?.filter((profile) => profile.type !== "guest")
?.filter(
(profile) =>
profile.type.toLowerCase() !== "guest" &&
profile.type.toLowerCase() !== "custom_jwt" &&
profile.type.toLowerCase() !== "custom_auth_endpoint",
)
.map((profile) => (
<LinkedProfile
key={`${JSON.stringify(profile)}`}
Expand Down
Loading