diff --git a/LICENSE.txt b/LICENSE.txt index 2af1fab..fafdcf6 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,4 +1,4 @@ -Copyright (c) 2012-2013 the original author or authors +Copyright (c) 2012-2014 the original author or authors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in diff --git a/README.md b/README.md index 066fc3e..38966e2 100644 --- a/README.md +++ b/README.md @@ -166,7 +166,7 @@ Please see CONTRIBUTING.md for details on how to contribute to this project. Copyright --------- -Copyright 2012-2013 the original author or authors +Copyright 2012-2014 the original author or authors msgs.js is made available under the MIT license. See LICENSE.txt for details. @@ -189,7 +189,7 @@ Change Log - moved .inboundGateway() and .outboundGateway() from msgs into msgs/gateways, when.js is now an optional dependency - bus.on('channel', listener) - syntatic sugar over outboundAdapter - receive'ing from a queue returns the full message, not just the payload -- update when.js to 2.x, dropping 1.x +- update when.js to 3.x, dropping 1.x 0.3.3 - extended when.js version to allow when@2.x diff --git a/bower.json b/bower.json index 03d4489..a37b811 100644 --- a/bower.json +++ b/bower.json @@ -3,7 +3,7 @@ "version": "0.4.0-pre", "main": "./msgs.js", "dependencies": { - "when": "~2" + "when": "~3" }, "ignore": [ ".*", diff --git a/package.json b/package.json index 85befbc..0d8c900 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ } ], "optionalDependencies": { - "when": "~2" + "when": "~3" }, "devDependencies": { "wire": "~0.10", diff --git a/test/gateways-test.js b/test/gateways-test.js index a293d92..3de57e2 100644 --- a/test/gateways-test.js +++ b/test/gateways-test.js @@ -1,5 +1,5 @@ /* - * Copyright 2012 the original author or authors + * Copyright 2012-2014 the original author or authors * @license MIT, see LICENSE.txt for details * * @author Scott Andrews @@ -29,24 +29,24 @@ bus.destroy(); }, - 'should resolve the gateway promise when there is no more work to do': function (done) { + 'should resolve the gateway promise when there is no more work to do': function () { bus.channel('target').subscribe(bus.transformer(function (payload) { return 'Knock, knock? ' + payload; })); - bus.inboundGateway('target')('Who\'s there?').then(function (response) { + return bus.inboundGateway('target')('Who\'s there?').then(function (response) { assert.same('Knock, knock? Who\'s there?', response); - }).otherwise(fail).always(done); + }).otherwise(fail); }, - 'should reject the gateway promise when an error is encountered': function (done) { + 'should reject the gateway promise when an error is encountered': function () { bus.channel('target').subscribe(bus.transformer(function (/* payload */) { throw new Error(); })); - bus.inboundGateway('target')('Who\'s there?').then( + return bus.inboundGateway('target')('Who\'s there?').then( fail, function (/* response */) { assert(true); } - ).always(done); + ); }, 'should apply a sequence number to gateway messages': function () { var handler, gateway; diff --git a/test/wire-test.js b/test/wire-test.js index 7597f33..f871684 100644 --- a/test/wire-test.js +++ b/test/wire-test.js @@ -1,5 +1,5 @@ /* - * Copyright 2013 the original author or authors + * Copyright 2013-2014 the original author or authors * @license MIT, see LICENSE.txt for details * * @author Scott Andrews @@ -25,24 +25,24 @@ require('msgs/channels/pubsub'); buster.testCase('msgs/wire', { - 'should support plugin namespaces': function (done) { + 'should support plugin namespaces': function () { var spec = { bus: { $ref: 'int:bus!' }, plugins: [{ module: 'msgs/wire', $ns: 'int' }] }; - wire(spec, { require: require }).then(function (spec) { + return wire(spec, { require: require }).then(function (spec) { var bus = spec.bus; refute.same(msgs, bus); assert.same(msgs.prototype, bus.prototype); - }).then(undef, fail).always(done); + }).then(undef, fail); }, - 'should chain bus from parent specs': function (done) { + 'should chain bus from parent specs': function () { var spec = { bus: { channels: 'parent' }, child: { wire: { spec: 'msgs/test/wire/nestedBus' } }, plugins: [{ module: 'msgs/wire' }] }; - wire(spec, { require: require }).then(function (spec) { + return wire(spec, { require: require }).then(function (spec) { var parent = spec.bus; return when(spec.child, function (spec) { var d, child; @@ -63,34 +63,34 @@ return d.promise; }); - }).then(undef, fail).always(done); + }).then(undef, fail); }, - 'should resolve the message bus for bus!': function (done) { + 'should resolve the message bus for bus!': function () { var spec = { bus: { $ref: 'bus!' }, plugins: [{ module: 'msgs/wire' }] }; - wire(spec, { require: require }).then(function (spec) { + return wire(spec, { require: require }).then(function (spec) { var bus = spec.bus; refute.same(msgs, bus); assert.same(msgs.prototype, bus.prototype); - }).then(undef, fail).always(done); + }).then(undef, fail); }, - 'should destroy the message bus when the spec is destroyed': function (done) { + 'should destroy the message bus when the spec is destroyed': function () { var spec, spy; spy = this.spy; spec = { bus: { $ref: 'bus!' }, plugins: [{ module: 'msgs/wire' }] }; - wire(spec, { require: require }).then(function (spec) { + return wire(spec, { require: require }).then(function (spec) { var bus, destroySpy; bus = spec.bus; destroySpy = bus.destroy = spy(bus.destroy); return spec.destroy().then(function () { assert.called(destroySpy); }); - }).then(undef, fail).always(done); + }).then(undef, fail); }, 'should send messages to the target channel as an inbound gateway': function (done) { var spec = { @@ -121,7 +121,7 @@ }).then(undef, fail); }, 'should create channels with the channels factory': { - 'returning the integration bus': function (done) { + 'returning the integration bus': function () { var spec = { bus: { $ref: 'bus!' }, integration: { @@ -129,11 +129,11 @@ }, plugins: [{ module: 'msgs/wire' }] }; - wire(spec, { require: require }).then(function (spec) { + return wire(spec, { require: require }).then(function (spec) { assert.same(spec.bus, spec.integration); - }).then(undef, fail).always(done); + }).then(undef, fail); }, - 'with a single channel name': function (done) { + 'with a single channel name': function () { var spec = { bus: { $ref: 'bus!' }, integration: { @@ -141,11 +141,11 @@ }, plugins: [{ module: 'msgs/wire' }] }; - wire(spec, { require: require }).then(function (spec) { + return wire(spec, { require: require }).then(function (spec) { assert.same('default', spec.bus.resolveChannel('world').type); - }).then(undef, fail).always(done); + }).then(undef, fail); }, - 'with an array of channel names': function (done) { + 'with an array of channel names': function () { var spec = { bus: { $ref: 'bus!' }, integration: { @@ -153,12 +153,12 @@ }, plugins: [{ module: 'msgs/wire' }] }; - wire(spec, { require: require }).then(function (spec) { + return wire(spec, { require: require }).then(function (spec) { assert.same('default', spec.bus.resolveChannel('hello').type); assert.same('default', spec.bus.resolveChannel('world').type); - }).then(undef, fail).always(done); + }).then(undef, fail); }, - 'with the desired type': function (done) { + 'with the desired type': function () { var spec = { bus: { $ref: 'bus!' }, integration: { @@ -168,11 +168,11 @@ }, plugins: [{ module: 'msgs/wire' }] }; - wire(spec, { require: require }).then(function (spec) { + return wire(spec, { require: require }).then(function (spec) { assert.same('pubsub', spec.bus.resolveChannel('world').type); - }).then(undef, fail).always(done); + }).then(undef, fail); }, - 'failing for unknown channel type': function (done) { + 'failing for unknown channel type': function () { var spec = { bus: { $ref: 'bus!' }, integration: { @@ -182,16 +182,16 @@ }, plugins: [{ module: 'msgs/wire' }] }; - wire(spec, { require: require }).then( + return wire(spec, { require: require }).then( fail, function (reason) { assert(reason.indexOf('Unable to define channels:') === 0); } - ).always(done); + ); } }, 'should create outboundAdapters for the subscribe facet': { - 'for a single target': function (done) { + 'for a single target': function () { var spec = { component: { literal: { @@ -208,12 +208,12 @@ }, plugins: [{ module: 'msgs/wire' }] }; - wire(spec, { require: require }).then(function (spec) { + return wire(spec, { require: require }).then(function (spec) { spec.bus.send('world', 'hello'); assert.called(spec.component.receive); - }).then(undef, fail).always(done); + }).then(undef, fail); }, - 'for multiple targets': function (done) { + 'for multiple targets': function () { var spec = { component: { literal: { @@ -237,11 +237,11 @@ }, plugins: [{ module: 'msgs/wire' }] }; - wire(spec, { require: require }).then(function (spec) { + return wire(spec, { require: require }).then(function (spec) { spec.bus.send('world', 'hello'); assert.called(spec.component.receive); assert.called(spec.altReceive); - }).then(undef, fail).always(done); + }).then(undef, fail); } } });