// @vitest-environment node import { describe, it, expect } from 'vitest' import { checkAuthRedirect } from '~/utils/auth' describe('checkAuthRedirect', () => { it.each(['/', '/login', '/signup', '/auth/callback'])( 'returns null for unauthenticated user on public route: %s', (path) => { expect(checkAuthRedirect(null, path)).toBeNull() } ) it('returns "/" for unauthenticated user on protected route', () => { expect(checkAuthRedirect(null, '/boats')).toBe('/') }) it('returns null for authenticated user on protected route', () => { expect(checkAuthRedirect({ id: 'user-123' }, '/boats')).toBeNull() }) it('returns null for authenticated user on public route', () => { expect(checkAuthRedirect({ id: 'user-123' }, '/')).toBeNull() }) })