Skip to content

Commit

Permalink
add another test
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristopherChudzicki committed Jul 8, 2024
1 parent e2bfe98 commit 3607ecd
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions frontends/mit-open/src/pages/SearchPage/SearchPage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,30 @@ describe("Search Page Tabs", () => {
expect(tab).toHaveAccessibleName(expectedActive)
})

test("Clearing facets does NOT reset tab", async () => {
setMockApiResponses({
search: {
count: 0,
metadata: {
aggregations: {
resource_category: [
{ key: "course", doc_count: 100 },
{ key: "program", doc_count: 10 },
],
},
suggestions: [],
},
},
})
const { location } = renderWithProviders(<SearchPage />, {
url: "?topic=Physics&resource_category=course",
})
const activeTab = screen.getByRole("tab", { selected: true })
expect(activeTab).toHaveTextContent("Courses")
await user.click(screen.getByRole("button", { name: /clear all/i }))
expect(location.current.search).toBe("?resource_category=course")
})

test.each([
{ programCount: 0, programsVisible: false, url: "?" },
{
Expand Down

0 comments on commit 3607ecd

Please sign in to comment.