Files
romm/frontend/__mocks__
Sam Dornan efb78679f8 Restore real timers globally and echo params from the shared i18n mock (#5043)
* Restore real timers from the global test setup and drop redundant teardown

vitest.setup.ts now calls vi.useRealTimers() after every test, so the 24
v2 test files that undid fake timers in their own afterEach no longer
need to, nor do three tests that wrapped their body in try/finally for
it. The hook is registered before enableAutoUnmount: Vitest runs
after-hooks in reverse, so components unmount while a test's fake clock
is still installed.

Also removes teardown that #5026 and #5028 made redundant: afterEach
unmounts of VTU wrappers in 11 files (with the variables and comments
that only existed to track them), and per-file setActivePinia calls
that the global beforeEach already makes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Echo params and expose locale from the shared vue-i18n mock

The shared mock's `t` now renders `key:{json params}` and `locale` is a
real ref, which covers what 19 test files built their own factory for:
a `locale` field, or a `t` that echoes params with `:` or `::`. Those
files now use the bare `vi.mock("vue-i18n")`, and the four `::` files'
assertions switch to the single colon.

24 assertions in 13 files that checked only a key now include the
params the component passes, so a dropped or wrong param fails them.
Factories that spy on `t` or render params in a test-specific shape
stay as they are.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Echo every argument to t from the shared vue-i18n mock

Pluralized messages pass the count second and the named values third,
so echoing only the second argument let a dropped `{n}` pass. The mock
now renders each argument after the key, and the four pluralized
assertions include the named values.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 12:55:24 -05:00
..