import { v4 as uuid } from 'uuid'

import camelizedVals from '../camelizeHelpers'

describe('camelizeHelpers', () => {
  describe('camelizedVals', () => {
    it('returns an array of values with camelized keys', () => {
      const exampleMap = {
        foo: { bar_baz: 'qux', woz_wiz: { groo_grux: 'hai' } },
        hello: { como_estas: 'bien' }
      }

      const listOfCamelizedValues = camelizedVals(exampleMap)

      expect(listOfCamelizedValues[0].barBaz).to.be.equal('qux')
      expect(listOfCamelizedValues[0].wozWiz.grooGrux).to.be.equal('hai')
      expect(listOfCamelizedValues[1].comoEstas).to.be.equal('bien')
    })

    it('does not convert a uuid to camel case', () => {
      const exampleUUID = uuid()
      const mapWithUUIDs = {
        foo: { [exampleUUID]: 'thisWorked' },
        bar: { baz_qux: 'val' }
      }

      const listOfCamelizedValues = camelizedVals(mapWithUUIDs)

      expect(listOfCamelizedValues[0][exampleUUID]).to.be.equal('thisWorked')
    })
  })
})
