From e3aecf673bbabcf96db9002ce3a87fef466497c8 Mon Sep 17 00:00:00 2001 From: Michael Reyna Date: Tue, 30 Apr 2024 13:50:15 -0500 Subject: [PATCH] Update test to reflect new content grouping --- src/tests/SearchBlock.test.tsx | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/tests/SearchBlock.test.tsx b/src/tests/SearchBlock.test.tsx index db17b699..06d683f1 100644 --- a/src/tests/SearchBlock.test.tsx +++ b/src/tests/SearchBlock.test.tsx @@ -138,17 +138,17 @@ describe('search', () => { fireEvent.click(screen.getByText('Search')) }) - await screen.findAllByText('Unit 4: Functions') + await screen.findByText('Unit 4: Functions') + act(() => { + fireEvent.click(screen.getByText('Unit 4: Functions')) + }) const firstHitLessonPage = await screen.findAllByText('4.16.3', { exact: false }) const secondHitLessonPage = await screen.findAllByText('4.14.2', { exact: false }) expect(firstHitLessonPage.length === 2) expect(secondHitLessonPage.length === 2) - expect(await screen.findByText('Lesson 4.16: Different Types of Sequences')) - expect(await screen.findByText('Lesson 4.14: Sequences')) + expect(await screen.findByText('Lesson 4.16: Different Types of Sequences; 4.16.3: A Sequence Is a Type of Function')) expect(await screen.findByText('table skips terms', { exact: false })) expect(await screen.findByText('smallest', { exact: false })) - expect(await screen.findByText('Teacher Content')) - expect(await screen.findByText('Content')) expect(global.fetch).toHaveBeenCalledWith('http://searchapi/v1/search?q=math&version=12345') }) @@ -169,12 +169,13 @@ describe('search', () => { }) await screen.findByText('Unit 4: Functions') + act(() => { + fireEvent.click(screen.getByText('Unit 4: Functions')) + }) const firstHitLessonPage = await screen.findAllByText('4.16.3', { exact: false }) expect(firstHitLessonPage.length === 1) - expect(await screen.findByText('Lesson 4.16: Different Types of Sequences')) + expect(await screen.findByText('Lesson 4.16: Different Types of Sequences; 4.16.3: A Sequence Is a Type of Function')) expect(await screen.findByText('table skips terms', { exact: false })) - expect(await screen.findByText('Teacher Content')) - expect(screen.queryByText('Content')).toBeNull() expect(global.fetch).toHaveBeenCalledWith('http://searchapi/v1/search?q=math&version=67890&filter=teacher') }) @@ -195,12 +196,13 @@ describe('search', () => { }) await screen.findByText('Unit 4: Functions') + act(() => { + fireEvent.click(screen.getByText('Unit 4: Functions')) + }) const firstHitLessonPage = await screen.findAllByText('4.16.3', { exact: false }) expect(firstHitLessonPage.length === 1) - expect(await screen.findByText('Lesson 4.16: Different Types of Sequences')) + expect(await screen.findByText('Lesson 4.16: Different Types of Sequences; 4.16.3: A Sequence Is a Type of Function')) expect(await screen.findByText('table skips terms', { exact: false })) - expect(await screen.findByText('Content')) - expect(screen.queryByText('Teacher Content')).toBeNull() expect(global.fetch).toHaveBeenCalledWith('http://searchapi/v1/search?q=math&version=13579&filter=student') }) })