From a17b82d0c34a2b7e5b5d885fe87d09407aa2ca42 Mon Sep 17 00:00:00 2001 From: Tam Nhu Tran Date: Mon, 6 Apr 2026 17:16:20 -0400 Subject: [PATCH] test(dashboard-auth): cover incomplete setup login copy --- ui/tests/unit/pages/login-page.test.tsx | 29 +++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/ui/tests/unit/pages/login-page.test.tsx b/ui/tests/unit/pages/login-page.test.tsx index 97ec0451..14dc5cbd 100644 --- a/ui/tests/unit/pages/login-page.test.tsx +++ b/ui/tests/unit/pages/login-page.test.tsx @@ -63,6 +63,35 @@ describe('LoginPage', () => { expect(screen.queryByRole('button', { name: 'Sign In' })).not.toBeInTheDocument(); }); + it('renders the incomplete setup copy when auth is enabled without credentials', () => { + useAuthMock.mockReturnValue({ + authRequired: true, + isAuthenticated: false, + username: null, + loading: false, + accessMode: 'setup', + authEnabled: true, + authConfigured: false, + isLocalAccess: false, + login: vi.fn(), + logout: vi.fn(), + }); + + render(); + + expect( + screen.getAllByText( + 'Dashboard auth is turned on, but the host setup is incomplete. Finish the host configuration before signing in.' + ) + ).not.toHaveLength(0); + expect( + screen.getByText( + 'Create or re-enable dashboard credentials, then reopen this page from the remote device.' + ) + ).toBeVisible(); + expect(screen.queryByLabelText('Username')).not.toBeInTheDocument(); + }); + it('toggles password visibility on the login form', async () => { render();