From bbb21ed7b4fc3af98526bd08eaa310f4b3984cde Mon Sep 17 00:00:00 2001 From: Zoltan Kochan Date: Wed, 27 Jan 2016 01:18:45 +0200 Subject: [PATCH] updated to use the new remi API --- index.js | 2 +- package.json | 2 +- test/index.js | 20 ++++++++++++++++---- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/index.js b/index.js index e394aa7..d5850a1 100644 --- a/index.js +++ b/index.js @@ -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) }) } diff --git a/package.json b/package.json index f9e8d5f..9f1e016 100644 --- a/package.json +++ b/package.json @@ -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" diff --git a/test/index.js b/test/index.js index 34955d2..70ea61a 100644 --- a/test/index.js +++ b/test/index.js @@ -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 @@ -13,7 +13,7 @@ describe('decorate', function() { beforeEach(function() { app = {} remi = new Remi({ - extensions: [decorate], + extensions: [{ extension: decorate }], }) }) @@ -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() + }) + }) })