Files
supabase/apps/studio/components/interfaces/UnifiedLogs/UnifiedLogs.hooks.test.tsx
Francesco Sansalvadore 0bf22ee6fc chore(studio): update product naming (#50208)
workers -> compute

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Added the Compute experience for deploying, viewing, managing, and
monitoring compute instances.
- Added Compute navigation, instance detail pages, secrets, logs,
deployment dialogs, generated snippets, and CLI commands.
- Added filtering, status, availability, and data-loading support for
compute instances.

- **Updates**
- Updated labels, icons, links, feature controls, unified logs, and
secret-deletion messaging to use Compute terminology.
  - Compute routes now replace the previous Workers routes and pages.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-09-10 16:26:48 +02:00

41 lines
1.2 KiB
TypeScript

import { act, renderHook } from '@testing-library/react'
import { afterEach, describe, expect, it, vi } from 'vitest'
import { useFilterSearchSync } from './UnifiedLogs.hooks'
describe('useFilterSearchSync', () => {
afterEach(() => {
vi.useRealTimers()
})
it('defers platform filter synchronization until feature flags load', () => {
vi.useFakeTimers()
const applyFilterSearch = vi.fn()
const computeFilter = [{ id: 'log_type', value: ['compute'] }]
const { rerender } = renderHook(
({ enabled }) =>
useFilterSearchSync({ applyFilterSearch, columnFilters: computeFilter, enabled }),
{ initialProps: { enabled: false } }
)
act(() => vi.advanceTimersByTime(1_000))
expect(applyFilterSearch).not.toHaveBeenCalled()
rerender({ enabled: true })
act(() => vi.advanceTimersByTime(250))
expect(applyFilterSearch).toHaveBeenCalledOnce()
})
it('synchronizes self-hosted filters without waiting for feature flags', () => {
vi.useFakeTimers()
const applyFilterSearch = vi.fn()
renderHook(() => useFilterSearchSync({ applyFilterSearch, columnFilters: [], enabled: true }))
act(() => vi.advanceTimersByTime(250))
expect(applyFilterSearch).toHaveBeenCalledOnce()
})
})