Files
opencode-manager/backend/test/helpers/log-assertions.ts
T
Chris Scott 6e398c4d40 fix(device-pairing): clean up push subscriptions on admin reset and share URL helpers
The admin password reset finds the admin case-insensitively and deletes the push subscriptions of the sessions it ends. The app re-sends its push subscription once per signed-in session so revoke reaches re-signed-in devices, and the upsert keeps the stored device name. Plain-HTTP and URL parsing checks are shared helpers.
2026-10-24 19:26:21 -04:00

25 lines
663 B
TypeScript

import { expect, type Mock } from 'vitest'
export interface LoggerMocks {
info: Mock
warn: Mock
error: Mock
debug: Mock
}
function loggedArguments(loggerMocks: LoggerMocks): unknown[][] {
return [...loggerMocks.info.mock.calls, ...loggerMocks.warn.mock.calls, ...loggerMocks.error.mock.calls]
}
export function expectNoSecretsLogged(loggerMocks: LoggerMocks, secrets: readonly string[]): void {
const calls = loggedArguments(loggerMocks)
expect(calls.length).toBeGreaterThan(0)
for (const args of calls) {
const serialized = JSON.stringify(args)
for (const value of secrets) {
expect(serialized).not.toContain(value)
}
}
}