diff --git a/packages/lib/src/subscriptions.ts b/packages/lib/src/subscriptions.ts index b2dbdb4c..9ecd493d 100644 --- a/packages/lib/src/subscriptions.ts +++ b/packages/lib/src/subscriptions.ts @@ -208,7 +208,7 @@ export class SubscriptionController { export class EventSubscriber, V=T> { _callbacks = new Array>(); lastResponse: Event | null = null; - lastResponseTime = 0; + lastResponseTime = -1; control?: Link; constructor( diff --git a/test/lib/subscriptions.js b/test/lib/subscriptions.js index b4c77470..3405fcfa 100644 --- a/test/lib/subscriptions.js +++ b/test/lib/subscriptions.js @@ -63,8 +63,8 @@ describe("lib/subscriptions", function() { assert.deepEqual(reconstructed, response); }); - it("should be round trip json serialisable with a null event replay", function() { - const response = new lib.SubscriptionResponse(null); + it("should be round trip json serialisable with an undefined event replay", function() { + const response = new lib.SubscriptionResponse(undefined); const json = JSON.stringify(response); assert.equal(typeof json, "string"); const reconstructed = lib.SubscriptionResponse.fromJSON(JSON.parse(json)); @@ -396,13 +396,13 @@ describe("lib/subscriptions", function() { describe("_updateSubscription()", function() { it("should correctly request a subscription", async function() { - const expected = new lib.SubscriptionRequest(RegisteredEvent.name, true); + const expected = new lib.SubscriptionRequest(RegisteredEvent.name, true, -1); registeredEvent.subscribe(() => true); await events.once(mockControl.connector, "send"); assertLastRequest(expected); }); - it("should correctly request a no subscriptions", async function() { - const expected = new lib.SubscriptionRequest(RegisteredEvent.name, false); + it("should correctly request no subscriptions", async function() { + const expected = new lib.SubscriptionRequest(RegisteredEvent.name, false, -1); function callback() {} registeredEvent.subscribe(callback); await events.once(mockControl.connector, "send");