From 835b31ebf6d6fe490e423bbc4ae620d133280c61 Mon Sep 17 00:00:00 2001 From: Afshin Mehrabani Date: Tue, 9 Jan 2024 08:54:06 +0000 Subject: [PATCH] fix tests --- src/view/plugin/search/search.tsx | 6 +++--- tests/jest/grid.test.ts | 1 + tests/jest/view/container.test.tsx | 4 ++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/view/plugin/search/search.tsx b/src/view/plugin/search/search.tsx index c449e68d..ab7a5984 100644 --- a/src/view/plugin/search/search.tsx +++ b/src/view/plugin/search/search.tsx @@ -67,9 +67,9 @@ export function Search() { }, [props]); useEffect(() => { - if (processor) { - config.pipeline.register(processor); - } + if (!processor) return undefined; + + config.pipeline.register(processor); return () => config.pipeline.unregister(processor); }, [config, processor]); diff --git a/tests/jest/grid.test.ts b/tests/jest/grid.test.ts index 440b0a10..bc3d542d 100644 --- a/tests/jest/grid.test.ts +++ b/tests/jest/grid.test.ts @@ -12,6 +12,7 @@ describe('Grid class', () => { it('should trigger the events in the correct order', async () => { const grid = new Grid({ + processingThrottleMs: 0, columns: ['a', 'b', 'c'], data: [[1, 2, 3]], }); diff --git a/tests/jest/view/container.test.tsx b/tests/jest/view/container.test.tsx index fae66f47..d3b548d0 100644 --- a/tests/jest/view/container.test.tsx +++ b/tests/jest/view/container.test.tsx @@ -20,6 +20,7 @@ describe('Container component', () => { beforeEach(() => { config = new Config().update({ + processingThrottleMs: 0, data: [ [1, 2, 3], ['a', 'b', 'c'], @@ -244,6 +245,7 @@ describe('Container component', () => { it('should render a container with array of objects without columns input', async () => { const config = Config.fromPartialConfig({ + processingThrottleMs: 0, data: [ [1, 2, 3], ['a', 'b', 'c'], @@ -285,6 +287,7 @@ describe('Container component', () => { it('should render a container with array of objects with object columns', async () => { const config = Config.fromPartialConfig({ + processingThrottleMs: 0, columns: [ { name: 'Name', @@ -341,6 +344,7 @@ describe('Container component', () => { it('should unregister the processors', async () => { const config = new Config().update({ + processingThrottleMs: 0, pagination: true, search: true, sort: true,