mirror of
https://github.com/duckietm/Nitro-V3.git
synced 2026-06-19 15:06:20 +00:00
ee3736474d
P2 core surgery: search result + NavigatorSearchEvent listener + sendSearch + reloadCurrentSearch all leave useNavigatorStore. The new useNavigatorSearch query hook owns the cache. useNavigatorActions is deleted entirely — the only two actions it exposed are gone, and no consumer outside Navigator depended on it. NavigatorMetadataEvent handler now seeds the UI store's currentTabCode on first arrival, activating the query the moment top-level contexts land. useNavigatorData: searchResult removed from closure and return. useNavigatorUiState: currentTabCode + currentFilter added. index.ts: useNavigatorActions removed, useNavigatorSearch added. NavigatorView.tsx is intentionally broken at this commit and gets fixed in the next.
28 lines
1.0 KiB
TypeScript
28 lines
1.0 KiB
TypeScript
import { renderHook } from '@testing-library/react';
|
|
import { describe, expect, it } from 'vitest';
|
|
import { useNavigatorData, useNavigatorUiState } from './index';
|
|
|
|
describe('navigator filter shapes (smoke)', () =>
|
|
{
|
|
it('useNavigatorData returns the documented keys', () =>
|
|
{
|
|
const { result } = renderHook(() => useNavigatorData());
|
|
expect(Object.keys(result.current).sort()).toEqual([
|
|
'categories', 'eventCategories', 'favouriteRoomIds',
|
|
'navigatorData', 'navigatorSearches',
|
|
'topLevelContext', 'topLevelContexts'
|
|
].sort());
|
|
});
|
|
|
|
it('useNavigatorUiState returns the 11 documented flags', () =>
|
|
{
|
|
const { result } = renderHook(() => useNavigatorUiState());
|
|
expect(Object.keys(result.current).sort()).toEqual([
|
|
'currentFilter', 'currentTabCode',
|
|
'isCreatorOpen', 'isLoading', 'isOpenSavesSearches',
|
|
'isReady', 'isRoomInfoOpen', 'isRoomLinkOpen', 'isVisible',
|
|
'needsInit', 'needsSearch'
|
|
].sort());
|
|
});
|
|
});
|