mirror of
https://github.com/supabase/supabase.git
synced 2026-10-09 11:25:06 +03:00
## I have read the [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) file. YES/NO ## What kind of change does this PR introduce? Bug fix, feature, docs update, ... ## What is the current behavior? Please link any relevant issues here. ## What is the new behavior? Feel free to include screenshots if it includes visual changes. ## Additional context Add any other context or screenshots. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Release Notes * **New Features** * Added “Continue with {provider}” sign-in and sign-up flows using enabled external identity providers. * Enabled inbound branding to focus a specific provider for customized sign-in/sign-up experiences. * **Improvements** * Refined the sign-in options layout and “last used” tracking for clearer authentication choices. * Updated account identity/provider connection experiences (link/unlink and management UI). * **Bug Fixes** * Fixed hydration mismatches in sign-in and password-related layouts. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com> Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
61 lines
1.8 KiB
TypeScript
61 lines
1.8 KiB
TypeScript
import { renderHook } from '@testing-library/react'
|
|
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
|
|
|
import { useShowMultigresLogs } from '../useShowMultigresLogs'
|
|
|
|
const mockUseFlag = vi.fn()
|
|
const mockUseIsHighAvailability = vi.fn()
|
|
|
|
vi.mock('common', async (importOriginal) => ({
|
|
...(await importOriginal<typeof import('common')>()),
|
|
useFlag: (name: string) => mockUseFlag(name),
|
|
}))
|
|
|
|
vi.mock('../useSelectedProject', () => ({
|
|
useIsHighAvailability: () => mockUseIsHighAvailability(),
|
|
}))
|
|
|
|
describe('useShowMultigresLogs', () => {
|
|
beforeEach(() => {
|
|
mockUseFlag.mockReset()
|
|
mockUseIsHighAvailability.mockReset()
|
|
})
|
|
|
|
it('returns true only when the multigresLogs flag and high availability are both enabled', () => {
|
|
mockUseFlag.mockReturnValue(true)
|
|
mockUseIsHighAvailability.mockReturnValue(true)
|
|
|
|
const { result } = renderHook(() => useShowMultigresLogs())
|
|
|
|
expect(result.current).toBe(true)
|
|
expect(mockUseFlag).toHaveBeenCalledWith('multigresLogs')
|
|
})
|
|
|
|
it('returns false when the flag is off, even on a high availability project', () => {
|
|
mockUseFlag.mockReturnValue(false)
|
|
mockUseIsHighAvailability.mockReturnValue(true)
|
|
|
|
const { result } = renderHook(() => useShowMultigresLogs())
|
|
|
|
expect(result.current).toBe(false)
|
|
})
|
|
|
|
it('returns false when the project is not high availability, even with the flag on', () => {
|
|
mockUseFlag.mockReturnValue(true)
|
|
mockUseIsHighAvailability.mockReturnValue(false)
|
|
|
|
const { result } = renderHook(() => useShowMultigresLogs())
|
|
|
|
expect(result.current).toBe(false)
|
|
})
|
|
|
|
it('returns false when both the flag and high availability are off', () => {
|
|
mockUseFlag.mockReturnValue(false)
|
|
mockUseIsHighAvailability.mockReturnValue(false)
|
|
|
|
const { result } = renderHook(() => useShowMultigresLogs())
|
|
|
|
expect(result.current).toBe(false)
|
|
})
|
|
})
|