From bf312c0b2cb90a0adfc626faebd05f3e92a64596 Mon Sep 17 00:00:00 2001 From: Serhii Mamontov Date: Wed, 3 Jul 2024 22:52:09 +0300 Subject: [PATCH] test(subscribe): add missing mock --- test/integration/endpoints/subscribe.test.ts | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/test/integration/endpoints/subscribe.test.ts b/test/integration/endpoints/subscribe.test.ts index 5f8b1b58d..e3c7a4599 100644 --- a/test/integration/endpoints/subscribe.test.ts +++ b/test/integration/endpoints/subscribe.test.ts @@ -249,7 +249,7 @@ describe('subscribe endpoints', () => { subscription.subscribe({ timetoken: '1234567890' }); }); - it('signal listener called for string signal', (done) => { + it.only('signal listener called for string signal', (done) => { utils .createNock() .get('/v2/subscribe/mySubKey/c1/0') @@ -259,13 +259,24 @@ describe('subscribe endpoints', () => { ee: '', tt: 0, }) + .reply(200, '{"t":{"t":"14523669555221452","r":1},"m":[]}', { 'content-type': 'text/javascript' }); + utils + .createNock() + .get('/v2/subscribe/mySubKey/c1/0') + .query({ + pnsdk: `PubNub-JS-Nodejs/${pubnub.getVersion()}`, + uuid: 'myUUID', + ee: '', + tt: '14523669555221452', + tr: 1, + }) .reply( 200, - '{"t":{"t":"14523669555221452","r":1},"m":[{"a":"3","f":0,"e":1,"i":"myUniqueUserId","p":{"t":"17200339136465528","r":41},"k":"mySubKey","c":"public.channel.1720033911251","d":"typing:start"}]}', + '{"t":{"t":"14523669555221453","r":1},"m":[{"a":"3","f":0,"e":1,"i":"myUniqueUserId","p":{"t":"17200339136465528","r":41},"k":"mySubKey","c":"c1","d":"typing:start"}]}', { 'content-type': 'text/javascript' }, ); - pubnub.addListener({ + pubnubWithEE.addListener({ signal(signal) { try { done(); @@ -277,6 +288,6 @@ describe('subscribe endpoints', () => { const channel = pubnubWithEE.channel('c1'); const subscription = channel.subscription(); - subscription.subscribe({ timetoken: '1234567890' }); + subscription.subscribe(); }); });