Skip to content

Commit

Permalink
updated to use the new remi API
Browse files Browse the repository at this point in the history
  • Loading branch information
zkochan committed Jan 26, 2016
1 parent 38d86ec commit bbb21ed
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion index.js
Expand Up @@ -20,7 +20,7 @@ module.exports = function(remi, opts) {
},
}

remi.pre('createPlugin', function(next, target, plugin) {
remi.pre('createPlugin', (next, target, plugin) => {
next(merge(target, extension), plugin)
})
}
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -35,7 +35,7 @@
"istanbul": "^0.4.2",
"mocha": "^2.3.4",
"plugiator": "^0.1.1",
"remi": "^0.3.0"
"remi": "^0.4.1"
},
"dependencies": {
"merge": "^1.2.0"
Expand Down
20 changes: 16 additions & 4 deletions test/index.js
Expand Up @@ -4,7 +4,7 @@ const expect = chai.expect
const plugiator = require('plugiator')

const Remi = require('remi')
const decorate = require('../')
const decorate = require('..')

describe('decorate', function() {
let remi
Expand All @@ -13,7 +13,7 @@ describe('decorate', function() {
beforeEach(function() {
app = {}
remi = new Remi({
extensions: [decorate],
extensions: [{ extension: decorate }],
})
})

Expand Down Expand Up @@ -75,14 +75,26 @@ describe('decorate', function() {
})

return remi
.register(app, plugin, {})
.register(app, plugin)
.then(() => {
expect(app.foo).to.eq('bar')

return remi.register(app, [plugiator.noop()], {})
return remi.register(app, [plugiator.noop()])
})
.then(() => {
expect(app.foo).to.eq('bar')
})
})

it('should through error if invalid parameters passed', function(done) {
let plugin = plugiator.anonymous((app, options) => {
app.decorate('server', 111)
})

remi.register(app, plugin)
.catch(err => {
expect(err).to.be.instanceOf(Error)
done()
})
})
})

0 comments on commit bbb21ed

Please sign in to comment.