import { vi, type MockedFunction } from 'vitest'
import { setNavigateToLogin } from '../../src/api'

// Replaces the production `navigateToLoginImpl` accessor (autodev Step 4 / C06)
// with a Vitest spy. Tests assert "redirect was invoked" via the returned
// function reference instead of stubbing window.location globally.
export function seedNavigateToLogin(): MockedFunction<() => void> {
  const spy = vi.fn()
  setNavigateToLogin(spy)
  return spy
}
