import { describe, expect, it } from 'vitest'
import { buildLoginRedirectTarget } from '../auth/route-guard'

describe('route guard helpers', () => {
  it('builds a login redirect target with encoded pathname, search, and hash', () => {
    const target = buildLoginRedirectTarget({
      pathname: '/app/downloads',
      search: '?platform=windows',
      hash: '#desktop-link',
    })

    expect(target).toBe('/login?next=%2Fapp%2Fdownloads%3Fplatform%3Dwindows%23desktop-link')
  })
})
