Skip to content

Commit

Permalink
Bump when.js version to 3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
scothis committed May 6, 2014
1 parent 6d848ae commit 9985365
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 46 deletions.
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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 [email protected]
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.4.0-pre",
"main": "./msgs.js",
"dependencies": {
"when": "~2"
"when": "~3"
},
"ignore": [
".*",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
}
],
"optionalDependencies": {
"when": "~2"
"when": "~3"
},
"devDependencies": {
"wire": "~0.10",
Expand Down
14 changes: 7 additions & 7 deletions test/gateways-test.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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;
Expand Down
68 changes: 34 additions & 34 deletions test/wire-test.js
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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;
Expand All @@ -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 = {
Expand Down Expand Up @@ -121,44 +121,44 @@
}).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: {
channels: 'world'
},
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: {
channels: 'world'
},
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: {
channels: ['hello', 'world']
},
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: {
Expand All @@ -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: {
Expand All @@ -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: {
Expand All @@ -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: {
Expand All @@ -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);
}
}
});
Expand Down

0 comments on commit 9985365

Please sign in to comment.