import {jsonHeaders, jwtHeader, httpHeaders} from '../httpHeaders'

describe('httpHeaders', () => {
  describe('jsonHeaders', () => {
    it('returns headers for json', () => {
      expect(jsonHeaders).to.deep.equal({
        Accept: 'application/json',
        'Content-Type': 'application/json'
      })
    })
  })

  describe('jwtHeader', () => {
    it('returns header with Signed Authorization token if authorizationMode is not specified', () => {
      const token = '123'
      expect(jwtHeader(token))
        .to.deep.equal({Authorization: token, AuthType: 'Signature'})
    })
  })

  describe('httpHeaders', () => {
    it('return jwtHeader with jsonHeader merged', () => {
      const token = '123'
      expect(httpHeaders(token)).to.deep.equal(
        Object.assign({}, jsonHeaders, jwtHeader(token))
      )
    })
  })
})
