Skip to content

Commit d95428c

Browse files
committed
test: remove the wrong assertion
1 parent 14c965a commit d95428c

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

test/use-swr-key.test.tsx

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
import { act, fireEvent, screen } from '@testing-library/react'
22
import React, { useState, useEffect } from 'react'
33
import useSWR from 'swr'
4-
import {
5-
createKey,
6-
createResponse,
7-
executeWithoutBatching,
8-
renderWithConfig,
9-
sleep
10-
} from './utils'
4+
import { createKey, createResponse, renderWithConfig, sleep } from './utils'
115

126
describe('useSWR - key', () => {
137
it('should respect requests after key has changed', async () => {
@@ -132,16 +126,10 @@ describe('useSWR - key', () => {
132126
}
133127

134128
renderWithConfig(<Page />)
135-
const closureSpy = jest.spyOn(closureFunctions, 'first')
136-
137129
await screen.findByText(`${baseKey}-first`)
138-
expect(closureSpy).toHaveBeenCalledTimes(1)
139130

140-
// update, but don't change the id.
141-
// Function identity should stay the same, and useSWR should not call the function again.
142-
executeWithoutBatching(() => updateId('first'))
131+
act(() => updateId('first'))
143132
await screen.findByText(`${baseKey}-first`)
144-
expect(closureSpy).toHaveBeenCalledTimes(1)
145133

146134
act(() => updateId('second'))
147135
await screen.findByText(`${baseKey}-second`)

0 commit comments

Comments
 (0)