Update SignIn tests for registration-gated SSO buttons.
This commit is contained in:
@@ -79,10 +79,10 @@ describe('SignIn', () => {
|
|||||||
expect(await screen.findByRole('button', { name: /Don't have an account\? Sign up/i })).toBeInTheDocument();
|
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({
|
mockGet.mockResolvedValue({
|
||||||
data: {
|
data: {
|
||||||
enable_account_registration: false,
|
enable_account_registration: true,
|
||||||
oauth: { google: true, microsoft: true },
|
oauth: { google: true, microsoft: true },
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -92,10 +92,25 @@ describe('SignIn', () => {
|
|||||||
expect(screen.getByRole('button', { name: 'Sign in with Microsoft' })).toBeInTheDocument();
|
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({
|
mockGet.mockResolvedValue({
|
||||||
data: {
|
data: {
|
||||||
enable_account_registration: false,
|
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 },
|
oauth: { google: false, microsoft: false },
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user