Skip to content

Commit

Permalink
optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
zkochan committed Feb 21, 2016
1 parent 0196540 commit e365584
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'
module.exports = function() {
return function(next, target, plugin, cb) {
module.exports = () => {
return (next, target, plugin, cb) => {
plugin.dependencies = [].concat(plugin.dependencies || [])

for (let dependency of plugin.dependencies) {
Expand All @@ -11,6 +11,6 @@ module.exports = function() {
}
}

next(target, plugin, cb)
next.applySame()
}
}
17 changes: 10 additions & 7 deletions test/index.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
'use strict'
const describe = require('mocha').describe
const it = require('mocha').it
const beforeEach = require('mocha').beforeEach
const expect = require('chai').expect
const remi = require('remi')
const remiDependencies = require('..')
const plugiator = require('plugiator')

describe('remi-dependencies', function() {
it('should not throw error if dependent plugin was registered', function() {
let registrator = remi({})
let registrator = remi({})

beforeEach(() => {
registrator = remi({})
})

it('should not throw error if dependent plugin was registered', function() {
registrator.hook(remiDependencies())

let foo = plugiator.noop('foo')
let bar = plugiator.noop({
const foo = plugiator.noop('foo')
const bar = plugiator.noop({
name: 'bar',
dependencies: ['foo'],
})
Expand All @@ -22,11 +27,9 @@ describe('remi-dependencies', function() {
})

it('should throw error if dependent plugin not present', function(done) {
let registrator = remi({})

registrator.hook(remiDependencies())

let plugin = plugiator.noop({
const plugin = plugiator.noop({
name: 'plugin1',
dependencies: ['foo'],
})
Expand Down

0 comments on commit e365584

Please sign in to comment.