Lovable sync 1777320812#71
Conversation
X-Lovable-Edit-ID: edt-08f3b3dd-f7ac-4f3a-adf4-06338789639a Co-authored-by: adm01-debug <231131902+adm01-debug@users.noreply.github.com>
📝 WalkthroughWalkthroughTwo test files refactored to improve validation approach: SSR test simplified by removing HTML comment detection, and stability test reworked to track component lifecycle events (mount/unmount) instead of render counts. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
⚔️ Resolve merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 0/1 reviews remaining, refill in 60 minutes.Comment |
There was a problem hiding this comment.
Pull request overview
This PR updates the DevInfraGate test suite to validate anti-flicker behavior using React lifecycle signals (mount/unmount) instead of render counting, and simplifies SSR assertions while keeping the same intent (no overlay output on the server).
Changes:
- Refactors the stability/anti-flicker test to track overlay mount/unmount events and assert no remount during stable state transitions.
- Simplifies the hydration/SSR test by removing redundant SSR output assertions while retaining the empty SSR HTML guarantee.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/components/DevInfraGateStability.test.tsx | Reworks anti-flicker coverage to assert lifecycle integrity (no unmount/remount) across rerenders and state transitions. |
| tests/components/DevInfraGateHydration.test.tsx | Removes redundant SSR assertions while keeping the SSR output requirement (''). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
🧹 Nitpick comments (2)
tests/components/DevInfraGateStability.test.tsx (2)
56-60: Make the “stable rerender” step actually change state.This rerender uses the same
useDevGate()return value, so it only proves a plain parent rerender does not remount the stub. If the intent is to cover the auth-refresh path described in the comment, drive the hook through a different-but-still-allowed state instead.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/components/DevInfraGateStability.test.tsx` around lines 56 - 60, The "stable rerender" should actually change the AuthContext value (or the useDevGate return object) while keeping isAllowed true so we exercise a change-of-reference scenario instead of a no-op rerender; update the test to call rerender with a new AuthContext.Provider value (or re-mock useDevGate to return a new object instance with isAllowed: true but different other fields) when rerendering <DevOnlyBridgeOverlay /> so useDevGate returns a different-but-still-allowed value and the overlay's stability is verified.
15-24: This mock can hide regressions in the real overlay.The lifecycle assertions are driven by a stubbed
BridgeMetricsOverlay, so the test only proves the mock mounts/unmounts. If the production overlay starts remounting or suspending differently, this will still pass.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/components/DevInfraGateStability.test.tsx` around lines 15 - 24, The test currently stubs BridgeMetricsOverlay (mock in DevInfraGateStability.test.tsx) which only proves the mock's lifecycle instead of the real component; change the mock to wrap/forward to the real module so lifecycleEvents record the actual BridgeMetricsOverlay behavior: use vi.importActual to get the real '@/components/dev/BridgeMetricsOverlay' and return a wrapper default export that runs the same useEffect (pushing 'mount'/'unmount') and then renders the real component (forwarding props and children) so the test asserts the real overlay's mount/unmount behavior rather than a pure stub.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@tests/components/DevInfraGateStability.test.tsx`:
- Around line 56-60: The "stable rerender" should actually change the
AuthContext value (or the useDevGate return object) while keeping isAllowed true
so we exercise a change-of-reference scenario instead of a no-op rerender;
update the test to call rerender with a new AuthContext.Provider value (or
re-mock useDevGate to return a new object instance with isAllowed: true but
different other fields) when rerendering <DevOnlyBridgeOverlay /> so useDevGate
returns a different-but-still-allowed value and the overlay's stability is
verified.
- Around line 15-24: The test currently stubs BridgeMetricsOverlay (mock in
DevInfraGateStability.test.tsx) which only proves the mock's lifecycle instead
of the real component; change the mock to wrap/forward to the real module so
lifecycleEvents record the actual BridgeMetricsOverlay behavior: use
vi.importActual to get the real '@/components/dev/BridgeMetricsOverlay' and
return a wrapper default export that runs the same useEffect (pushing
'mount'/'unmount') and then renders the real component (forwarding props and
children) so the test asserts the real overlay's mount/unmount behavior rather
than a pure stub.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: e7e9c17a-5bb2-4a4b-86b1-f8a7536767c0
📒 Files selected for processing (2)
tests/components/DevInfraGateHydration.test.tsxtests/components/DevInfraGateStability.test.tsx
💤 Files with no reviewable changes (1)
- tests/components/DevInfraGateHydration.test.tsx
❌ Encerrado por conflito
PR só refatora 2 arquivos de teste do Branch original |
Pull Request
📝 Descrição
🎯 Tipo de mudança
🔗 Issue relacionada
✅ Checklist
npx tsc --noEmitpassa sem errosnpm run test)console.logem código de produção (apenaslogger.*)mem://) se a mudança afetar arquitetura/regras🧪 Como testar
📸 Screenshots (se UI)
Summary by CodeRabbit