import { parseLabelsParam } from './parse-labels-param'

describe('parseLabelsParam', () => {
  it('returns false when there is no hash query', () => {
    expect(parseLabelsParam('')).toBe(false)
  })

  it('returns false when the labels param is absent', () => {
    expect(parseLabelsParam('foo=bar')).toBe(false)
  })

  it('returns false for labels=false', () => {
    expect(parseLabelsParam('labels=false')).toBe(false)
  })

  it('returns true for labels=true and other truthy values', () => {
    expect(parseLabelsParam('labels=true')).toBe(true)
    expect(parseLabelsParam('labels=1')).toBe(true)
    expect(parseLabelsParam('labels=yes')).toBe(true)
  })

  it('coexists with other params, including embed', () => {
    expect(parseLabelsParam('embed=va&labels=true')).toBe(true)
    expect(parseLabelsParam('foo=bar&labels=false&baz=qux')).toBe(false)
  })
})
