Skip to content

Commit

Permalink
Update test to reflect new content grouping
Browse files Browse the repository at this point in the history
  • Loading branch information
MReyna12 committed Apr 30, 2024
1 parent 9163688 commit e3aecf6
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/tests/SearchBlock.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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')
})

Expand All @@ -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')
})

Expand All @@ -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')
})
})

0 comments on commit e3aecf6

Please sign in to comment.