import { parseEmbedParam } from './parse-embed-param'

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

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

  it("returns 'va' for embed=va", () => {
    expect(parseEmbedParam('embed=va')).toBe('va')
    expect(parseEmbedParam('foo=bar&embed=va')).toBe('va')
  })

  it('returns false for embed=false', () => {
    expect(parseEmbedParam('embed=false')).toBe(false)
  })

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