import { describe, expect, it } from "@jest/globals"

import { getBranchPrefix } from "./getBranchPrefix"

describe("getBranchPrefix", () => {
  it("should return empty string for production branches", () => {
    expect(getBranchPrefix("production")).toBe("")
    expect(getBranchPrefix("prod")).toBe("")
    expect(getBranchPrefix("release")).toBe("")
    expect(getBranchPrefix("release-v1")).toBe("")
    expect(getBranchPrefix("release-v1.2")).toBe("")
    expect(getBranchPrefix("release-v1.2.3")).toBe("")
    expect(getBranchPrefix("release-v1.2.3-rc1")).toBe("")
    expect(getBranchPrefix("release-v1.2-beta")).toBe("")
    expect(getBranchPrefix("release-v1-preview")).toBe("")
  })

  it("should return branch name for non-production branches", () => {
    expect(getBranchPrefix("feature/hello")).toBe("feature/hello")
    expect(getBranchPrefix("fix/stuff")).toBe("fix/stuff")
    expect(getBranchPrefix("releasee")).toBe("releasee")
    expect(getBranchPrefix("release-vA")).toBe("release-vA")
    expect(getBranchPrefix("release-v1.A")).toBe("release-v1.A")
    expect(getBranchPrefix("release-v1.2.A")).toBe("release-v1.2.A")
    expect(getBranchPrefix("release-v1.2.A-rc1")).toBe("release-v1.2.A-rc1")
    expect(getBranchPrefix("release-v1.A-beta")).toBe("release-v1.A-beta")
    expect(getBranchPrefix("release-vA-preview")).toBe("release-vA-preview")
  })
})
