diff --git a/hooks/test/browser/useId.test.js b/hooks/test/browser/useId.test.js index b7d25ebaeab..48c9fafac6e 100644 --- a/hooks/test/browser/useId.test.js +++ b/hooks/test/browser/useId.test.js @@ -378,4 +378,31 @@ describe('useId', () => { render(, scratch); expect(ids).to.deep.equal(['P491', 'P501']); }); + + it('should reset for each renderToString roots', () => { + const ids = []; + + function Foo() { + const id = useId(); + ids.push(id); + return

{id}

; + } + + function App() { + return ( +
+ + + + + + +
+ ); + } + + const res1 = rts(); + const res2 = rts(); + expect(res1).to.equal(res2); + }); });