mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix: stabilize catalog filter coverage imports
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Comment } from '@bitsocialhq/bitsocial-react-hooks';
|
||||
import type { Comment } from '@bitsocialhq/bitsocial-react-hooks';
|
||||
import useSubplebbitsStore from '@bitsocialhq/bitsocial-react-hooks/dist/stores/subplebbits';
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,6 +7,10 @@ const testState = vi.hoisted(() => ({
|
||||
}),
|
||||
}));
|
||||
|
||||
vi.mock('../../lib/utils/pattern-utils', () => ({
|
||||
commentMatchesPattern: (comment: unknown, pattern: string) => testState.commentMatchesPatternMock(comment as never, pattern),
|
||||
}));
|
||||
|
||||
type CatalogFiltersStoreModule = typeof import('../use-catalog-filters-store');
|
||||
type CatalogFiltersStore = Awaited<ReturnType<typeof loadStore>>;
|
||||
|
||||
@@ -14,10 +18,6 @@ const STORAGE_KEY = 'catalog-filters-storage';
|
||||
|
||||
const loadStore = async () => {
|
||||
vi.resetModules();
|
||||
vi.doMock('../../lib/utils/pattern-utils', () => ({
|
||||
commentMatchesPattern: (comment: unknown, pattern: string) => testState.commentMatchesPatternMock(comment as never, pattern),
|
||||
}));
|
||||
|
||||
const module = (await import('../use-catalog-filters-store')) as CatalogFiltersStoreModule;
|
||||
await Promise.resolve();
|
||||
return module.default;
|
||||
@@ -48,7 +48,6 @@ describe('useCatalogFiltersStore', () => {
|
||||
|
||||
afterEach(() => {
|
||||
vi.useRealTimers();
|
||||
vi.doUnmock('../../lib/utils/pattern-utils');
|
||||
consoleWarnSpy.mockRestore();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user