Files
nous-portal/tests
AlexKucera 544af1eeea test: drive login poll loop with a fake clock
Give login an optional clock ({ now, sleep }) with the real timers as
the default, so the device-code poll loop can be tested without
wall-clock time. Neither t.mock.timers nor jiti aliasing reaches
node:timers/promises, so a seam is the only way in; auth.oauth.login
still passes only the interaction, so pi's interface is unchanged.

Six tests cover pending to slow_down to success, the interval fallback
and floor, the deadline cap, a non-retryable error and a non-OK device
code response. The token mock gives up after 100 polls: an
auto-advancing fake starves the event loop, so a sleep-less regression
would otherwise hang the suite with no test timeout able to fire.
2026-11-25 13:50:00 +01:00
..