Skip to content

Commit

Permalink
Remove duplicate test
Browse files Browse the repository at this point in the history
Accidentally committed two copies of this test during a rebase.
  • Loading branch information
acdlite committed Sep 8, 2021
1 parent d4d1dc0 commit 95d762e
Showing 1 changed file with 0 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -570,29 +570,6 @@ describe('Shared useSyncExternalStore behavior (shim and built-in)', () => {
}
});

test('Infinite loop if getSnapshot keeps returning new reference', () => {
const store = createExternalStore({});

function App() {
const text = useSyncExternalStore(store.subscribe, () => ({}));
return <Text text={JSON.stringify(text)} />;
}

spyOnDev(console, 'error');
const root = createRoot();

expect(() => act(() => root.render(<App />))).toThrow(
'Maximum update depth exceeded. This can happen when a component repeatedly ' +
'calls setState inside componentWillUpdate or componentDidUpdate. React limits ' +
'the number of nested updates to prevent infinite loops.',
);
if (__DEV__) {
expect(console.error.calls.argsFor(0)[0]).toMatch(
'The result of getSnapshot should be cached to avoid an infinite loop',
);
}
});

describe('extra features implemented in user-space', () => {
test('memoized selectors are only called once per update', async () => {
const store = createExternalStore({a: 0, b: 0});
Expand Down

0 comments on commit 95d762e

Please sign in to comment.