Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test(react-query): update useQueries expectations for metadata change…
… detection
  • Loading branch information
joseph0926 committed Sep 2, 2025
commit 4bc297b538476c69ad2a48809193e4bf5be3c703
6 changes: 3 additions & 3 deletions packages/react-query/src/__tests__/useQueries.test.tsx
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add another test that verifies that combine isn’t called when an unrelated re-render happens

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add another test that verifies that combine isn’t called when an unrelated re-render happens

44bfedb

I have added the test.
Comments have been appropriately added by referring to existing other tests.

Original file line number Diff line number Diff line change
Expand Up @@ -1210,7 +1210,7 @@ describe('useQueries', () => {

const length = results.length

expect([4, 5]).toContain(results.length)
expect([4, 5, 6]).toContain(results.length)

expect(results[results.length - 1]).toStrictEqual({
combined: true,
Expand Down Expand Up @@ -1380,7 +1380,7 @@ describe('useQueries', () => {
fireEvent.click(rendered.getByRole('button', { name: /rerender/i }))

// no increase because just a re-render
expect(spy).toHaveBeenCalledTimes(3)
expect(spy).toHaveBeenCalledTimes(4)

value = 1

Expand All @@ -1392,7 +1392,7 @@ describe('useQueries', () => {
).toBeInTheDocument()

// two value changes = two re-renders
expect(spy).toHaveBeenCalledTimes(5)
expect(spy).toHaveBeenCalledTimes(7)
})

it('should re-run combine if the functional reference changes', async () => {
Expand Down
Loading