Skip to content

Commit

Permalink
test(subscribe): add missing mock
Browse files Browse the repository at this point in the history
  • Loading branch information
parfeon committed Jul 3, 2024
1 parent d7549d3 commit bf312c0
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions test/integration/endpoints/subscribe.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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();
Expand All @@ -277,6 +288,6 @@ describe('subscribe endpoints', () => {

const channel = pubnubWithEE.channel('c1');
const subscription = channel.subscription();
subscription.subscribe({ timetoken: '1234567890' });
subscription.subscribe();
});
});

0 comments on commit bf312c0

Please sign in to comment.