Skip to content

Commit

Permalink
refactor method data test
Browse files Browse the repository at this point in the history
  • Loading branch information
ganimomer committed Mar 27, 2017
1 parent 8d960ce commit d3ba2cf
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tests/lib/util/methodData.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ const assert = require('assert')
const v4 = require('../../../src/util/methodDataByVersion/4')
const _ = require('lodash')
describe('methodData', () => {
it('should have an entry for every item', () => {
it('should have an entry for every item on Lodash', () => {
const functions = _.keys(_.pickBy(_, m => _.isFunction(m) && m !== _))
for (const f of functions) {
assert(v4[f] || _.some(v4, ({aliases}) => _.includes(aliases, f)), `${f} has no entry`)
}
const methodsNotCovered = _(functions).difference(_.keys(v4)).reject(f => _.some(v4, ({aliases}) => _.includes(aliases, f))).value()
assert.equal(methodsNotCovered.length, 0, `there are no entries for methods ${methodsNotCovered}`)
})
it('should have an entry for every item on the wrapper object', () => {
const wrapper = _()
const wrapperFunctions = _.keys(_.pickBy(wrapper, _.isFunction))
for (const f of wrapperFunctions) {
assert(v4[f] || _.some(v4, ({aliases}) => _.includes(aliases, f)), `wrapper method ${f} has no entry`)
}
const methodsNotCovered = _(wrapperFunctions).difference(_.keys(v4)).reject(f => _.some(v4, ({aliases}) => _.includes(aliases, f))).value()
assert.deepEqual(methodsNotCovered.length, 0, `there are no entries for wrapper methods ${methodsNotCovered}`)
})
})

0 comments on commit d3ba2cf

Please sign in to comment.