Skip to content

Commit

Permalink
Minor test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonWoolf committed Mar 11, 2017
1 parent f6c52f3 commit 9cf0340
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion spec/realtime/channel.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ define(['ably', 'shared_helper', 'async'], function(Ably, helper, async) {
channel.attach();
channel.whenState('attached', function() {
firedImmediately = true;
test.ok(channel.state === 'attached', 'whenState fired when attached');
test.equal(channel.state, 'attached', 'whenState fired when attached');
closeAndFinish(test, realtime);
});
test.ok(!firedImmediately, 'whenState should not fire immediately as not attached');
Expand Down
7 changes: 4 additions & 3 deletions spec/realtime/connection.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ define(['ably', 'shared_helper', 'async'], function(Ably, helper, async) {
channel = realtime.channels.get('connectionQueuing'),
connectionManager = realtime.connection.connectionManager;

connectionManager.once('transport.active', function(transport) {
realtime.connection.once('connected', function() {
var transport = connectionManager.activeProtocol.transport;
channel.attach(function(err) {
if(err) {
test.ok(false, 'Attach failed with error: ' + helper.displayError(err));
Expand All @@ -160,7 +161,7 @@ define(['ably', 'shared_helper', 'async'], function(Ably, helper, async) {
},
function(cb) {
/* After the disconnect, on reconnect, spy on transport.send again */
connectionManager.once('transport.active', function(transport) {
connectionManager.once('transport.pending', function(transport) {
var oldSend = transport.send;

transport.send = function(msg, msgCb) {
Expand All @@ -169,7 +170,7 @@ define(['ably', 'shared_helper', 'async'], function(Ably, helper, async) {
test.equal(msg.msgSerial, 0, 'Expect msgSerial of original message to still be 0');
test.equal(msg.messages.length, 1, 'Expect second message to not have been merged with the attempted message');
} else if(msg.messages[0].name === 'second') {
test.equal(msg.msgSerial, 1, 'Expect msgSerial of new message to be 0');
test.equal(msg.msgSerial, 1, 'Expect msgSerial of new message to be 1');
cb();
}
}
Expand Down
2 changes: 1 addition & 1 deletion spec/realtime/presence.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1626,7 +1626,7 @@ define(['ably', 'shared_helper', 'async'], function(Ably, helper, async) {
* set but missing from a sync */
exports.leave_published_for_member_missing_from_sync = function(test) {
test.expect(6);
var realtime = helper.AblyRealtime(),
var realtime = helper.AblyRealtime({transports: helper.availableTransports}),
continuousClientId = 'continuous',
goneClientId = 'gone',
continuousRealtime = helper.AblyRealtime({clientId: continuousClientId}),
Expand Down
6 changes: 3 additions & 3 deletions spec/realtime/upgrade.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -540,9 +540,9 @@ define(['ably', 'shared_helper', 'async'], function(Ably, helper, async) {

realtime.connection.once('connected', function() {
channel.attach(function(err){
test.ok(err.code, 90000, 'Check error code for channel attach timing out');
test.ok(channel.state, 'suspended', 'Check channel goes into suspended state');
test.ok(realtime.connection.state, 'connected', 'Check connection state is still connected');
test.equal(err.code, 90007, 'Check error code for channel attach timing out');
test.equal(channel.state, 'suspended', 'Check channel goes into suspended state');
test.equal(realtime.connection.state, 'connected', 'Check connection state is still connected');
channel.attach(function(err){
test.ok(!err, 'Check a second attach works fine');
closeAndFinish(test, realtime)
Expand Down

0 comments on commit 9cf0340

Please sign in to comment.