diff --git a/package.json b/package.json index 47a497a..e4010b0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,9 @@ { "name": "loopback-component-push", "version": "1.7.0", + "publishConfig": { + "tag": "lts" + }, "description": "Loopback Push Notification", "keywords": [ "StrongLoop Labs", @@ -30,8 +33,9 @@ "deep-extend": "^0.4.0", "eslint": "^2.13.1", "eslint-config-loopback": "^4.0.0", - "loopback": "^3.0.0", + "loopback": "^2.36.0", "loopback-connector-mongodb": "^1.8.0", + "loopback-datasource-juggler": "^2.53.0", "mocha": "^2.2.0", "should": "^6.0.0", "sinon": "^1.14.0" diff --git a/test/apns.provider.test.js b/test/apns.provider.test.js index b535c6b..8cc7fc3 100644 --- a/test/apns.provider.test.js +++ b/test/apns.provider.test.js @@ -154,6 +154,8 @@ describe('APNS provider', function() { }); it('emits "error" when gateway cannot be reached', function(done) { + var CONNECT_TIMEOUT = 2000; + this.timeout(1.5 * CONNECT_TIMEOUT); givenProviderWithConfig({ apns: { certData: objectMother.apnsDevCert(), @@ -169,15 +171,25 @@ describe('APNS provider', function() { provider.pushNotification(notification, aDeviceToken); + var start = Date.now(); + // wait for the provider to attempt to connect - setTimeout(function() { + // periodically check whether it has happened yet + var interval = setInterval(function() { + var elapsed = Date.now() - start; + if (!eventSpy.called && elapsed < CONNECT_TIMEOUT) + return; // still connecting + + clearInterval(interval); + expect(eventSpy.called, 'error event should be emitted') .to.equal(true); + var args = eventSpy.firstCall.args; expect(args[0]).to.be.instanceOf(Error); expect(args[0].code).to.equal('ECONNREFUSED'); done(); - }, 250); + }, 50); }); });