Zum Inhalt springen
Kitbay
Skill

router-act

MITAktualisiert am 11. Nov. 2026143.470GitHub-Sterne

An internal skill in the Next.js repository for writing end-to-end tests that involve prefetching, client-side navigation or the segment cache.

Was der Skill vermittelt

An internal skill in the Next.js repository for writing end-to-end tests that involve prefetching, client-side navigation or the segment cache. It explains the repository's createRouterAct helper, which intercepts router requests inside a scope, buffers the responses and asserts on them, so tests do not depend on exact request counts. Links are hidden behind a LinkAccordion component and revealed inside the scope so prefetches happen only when the test wants them, and the preferred assertion proves the cache served the data with no requests. It warns against polling and timeouts, reading page content before the scope ends, and going back with open accordions, and uses Playwright's fake clock for staleness tests.

Funktionen

  • Control router prefetch timing in tests
  • Assert that the cache served a navigation
  • Test staleness with a fake clock