Commit 7f48a0c9 authored by Robert Knight's avatar Robert Knight

Fix two slow tests

 * Avoid `assert.includes()` in Bridge test, since this does a deep
   equality comparison which is much more expensive than necessary
   (50-60ms to execute on a desktop system with no contention. I think
   this might explain the very occassional failure seen on Travis).

 * Use the correct name for the `retries` option in a
   retryPromiseOperation() test. This test should have failed but
   because the min timeout value was set so low, the test was taking < 2
   seconds to run even though it was retrying 10 times with an
   expontentially increasing timeout.
parent bf7af70c
...@@ -37,7 +37,9 @@ describe 'Bridge', -> ...@@ -37,7 +37,9 @@ describe 'Bridge', ->
it 'adds the channel to the .links property', -> it 'adds the channel to the .links property', ->
channel = createChannel() channel = createChannel()
assert.include(bridge.links, {channel: channel, window: fakeWindow}) assert.isTrue(bridge.links.some((link) ->
link.channel == channel && link.window == fakeWindow
))
it 'registers any existing listeners on the channel', -> it 'registers any existing listeners on the channel', ->
message1 = sandbox.spy() message1 = sandbox.spy()
......
'use strict';
var retryUtil = require('../retry-util'); var retryUtil = require('../retry-util');
var toResult = require('./promise-util').toResult; var toResult = require('./promise-util').toResult;
...@@ -35,8 +37,8 @@ describe('retry-util', function () { ...@@ -35,8 +37,8 @@ describe('retry-util', function () {
return Promise.reject(error); return Promise.reject(error);
}); });
var wrappedOperation = retryUtil.retryPromiseOperation(operation, { var wrappedOperation = retryUtil.retryPromiseOperation(operation, {
minTimeout: 1, minTimeout: 3,
maxRetries: 2, retries: 2,
}); });
return toResult(wrappedOperation).then(function (result) { return toResult(wrappedOperation).then(function (result) {
assert.equal(result.error, error); assert.equal(result.error, error);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment