From 1a434b208e18bc30d74023df79154e2f480cef5b Mon Sep 17 00:00:00 2001 From: Ryan Westfall Date: Wed, 5 Aug 2026 09:02:58 -0500 Subject: [PATCH] Update SignIn tests for registration-gated SSO buttons. --- .../src/llm-fe/pages/SignIn/SignIn.test.tsx | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/llm-fe/src/llm-fe/pages/SignIn/SignIn.test.tsx b/llm-fe/src/llm-fe/pages/SignIn/SignIn.test.tsx index 9608417..83adfe7 100644 --- a/llm-fe/src/llm-fe/pages/SignIn/SignIn.test.tsx +++ b/llm-fe/src/llm-fe/pages/SignIn/SignIn.test.tsx @@ -79,10 +79,10 @@ describe('SignIn', () => { expect(await screen.findByRole('button', { name: /Don't have an account\? Sign up/i })).toBeInTheDocument(); }); - it('shows SSO buttons when oauth providers configured', async () => { + it('shows SSO buttons when registration enabled and oauth providers configured', async () => { mockGet.mockResolvedValue({ data: { - enable_account_registration: false, + enable_account_registration: true, oauth: { google: true, microsoft: true }, }, }); @@ -92,10 +92,25 @@ describe('SignIn', () => { expect(screen.getByRole('button', { name: 'Sign in with Microsoft' })).toBeInTheDocument(); }); - it('hides SSO buttons when oauth not configured', async () => { + it('hides SSO buttons when registration disabled even if oauth configured', async () => { mockGet.mockResolvedValue({ data: { enable_account_registration: false, + oauth: { google: true, microsoft: true }, + }, + }); + renderSignIn(); + + await waitFor(() => { + expect(screen.queryByRole('button', { name: 'Continue with Google' })).not.toBeInTheDocument(); + expect(screen.queryByRole('button', { name: 'Sign in with Microsoft' })).not.toBeInTheDocument(); + }); + }); + + it('hides SSO buttons when oauth not configured', async () => { + mockGet.mockResolvedValue({ + data: { + enable_account_registration: true, oauth: { google: false, microsoft: false }, }, });