Skip to content

Commit

Permalink
✅ Add tests for build package
Browse files Browse the repository at this point in the history
  • Loading branch information
Sumolari committed Feb 18, 2019
1 parent 5ba4794 commit ef81a75
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 11 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"type-check:watch": "run-s \"type-check --watch\"",
"test": "run-s test:*",
"test:types": "run-s type-check",
"test:unit": "nyc mocha test/**/*.ts",
"test:dist": "run-s build && es-check es5 dist/**/*.js",
"test:unit": "nyc mocha test/unit/**/*.ts test/integration/**/*.ts",
"test:dist": "run-s build && es-check es5 dist/**/*.js && mocha test/e2e/**/*.ts",
"coverage": "nyc report --reporter=text-lcov | coveralls",
"build": "run-s build:*",
"build:clean": "rm -rf dist",
Expand Down
27 changes: 27 additions & 0 deletions test/e2e/index.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import _ from 'lodash'
import lodashMixins from '../..'
import { expect } from 'chai'

import injectedMethods from '../exportedMethods'

describe('Exported package', function () {
describe('Before loading mixins', function () {
for (const method of injectedMethods) {
it(`Should not have «${method}» present`, function () {
expect(_).to.not.have.property(method).that.is.a('function')
})
}
})

describe('When loading exported package', function () {
before('Load mixins', function () {
lodashMixins(_)
})

for (const method of injectedMethods) {
it(`Should have «${method}» present`, function () {
expect(_).to.have.property(method).that.is.a('function')
})
}
})
})
9 changes: 9 additions & 0 deletions test/exportedMethods.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export default [
'fromPairsMap',
'getTruthyKeys',
'hasTruthyValues',
'mapNonNil',
'mergeForEach',
'mGet',
'shortcuttedReduce'
]
10 changes: 1 addition & 9 deletions test/integration/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,7 @@ import _ from 'lodash'
import lodashMixins from '../../src/index'
import { expect } from 'chai'

const injectedMethods = [
'fromPairsMap',
'getTruthyKeys',
'hasTruthyValues',
'mapNonNil',
'mergeForEach',
'mGet',
'shortcuttedReduce'
]
import injectedMethods from '../exportedMethods'

describe('Exported package', function () {
describe('Before loading mixins', function () {
Expand Down

0 comments on commit ef81a75

Please sign in to comment.