mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 20:34:18 +01:00
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.
25 lines
663 B
TypeScript
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)
|
|
}
|
|
}
|
|
}
|