import { describe, it, expect } from 'vitest'
import { getBranchUrl } from '@/lib/job-status-url'

describe('getBranchUrl', () => {
  it('builds a GitHub tree URL from repo URL and branch', () => {
    expect(getBranchUrl('https://github.com/owner/repo', 'feat/job-abc12345')).toBe(
      'https://github.com/owner/repo/tree/feat/job-abc12345',
    )
  })

  it('strips trailing .git suffix', () => {
    expect(getBranchUrl('https://github.com/owner/repo.git', 'feat/job-abc')).toBe(
      'https://github.com/owner/repo/tree/feat/job-abc',
    )
  })

  it('strips trailing slash', () => {
    expect(getBranchUrl('https://github.com/owner/repo/', 'feat/job-abc')).toBe(
      'https://github.com/owner/repo/tree/feat/job-abc',
    )
  })
})
