Skip to content

Commit

Permalink
tes(publish): fix customMessageType test
Browse files Browse the repository at this point in the history
  • Loading branch information
parfeon committed Nov 17, 2024
1 parent 209e56c commit 7c3596a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
3 changes: 1 addition & 2 deletions test/integration/endpoints/fetch_messages.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,7 @@ describe('fetch messages endpoints', () => {
const messageTimetokens = messages.map((message) => message.timetoken);

pubnub.fetchMessages({ channels: [channel], includeCustomMessageType: true }, (status, response) => {
if (status.error) console.error(`Fetch messages error: ${JSON.stringify(status.errorData)}`);
assert.equal(status.error, false);
assert.equal(status.error, false, `Fetch messages error: ${JSON.stringify(status.errorData)}`);

try {
assert.equal(status.error, false);
Expand Down
31 changes: 16 additions & 15 deletions test/integration/endpoints/publish.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ describe('publish endpoints', () => {
});
});

it('supports customMessageType', (done) => {
it.only('supports customMessageType', (done) => {
const scope = utils
.createNock()
.get('/publish/myPublishKey/mySubKey/0/ch1/0/%7B%22such%22%3A%22object%22%7D')
Expand All @@ -219,23 +219,24 @@ describe('publish endpoints', () => {
uuid: 'myUUID',
auth: 'myAuthKey',
store: '0',
custom_message_type: 'test-message-type',
})
.reply(200, '[1,"Sent","14647523059145592"]', { 'content-type': 'text/javascript' });

pubnub.setCipherKey('myCipherKey');

pubnub.publish({ message: { such: 'object' }, channel: 'ch1', storeInHistory: false }, (status, response) => {
try {
assert.equal(status.error, false);
if (status.error) console.error(`Message publish error: ${JSON.stringify(status.errorData)}`);
assert(response !== null);
assert.deepEqual(response.timetoken, '14647523059145592');
assert.equal(scope.isDone(), true);
done();
} catch (error) {
done(error);
}
});
pubnub.publish(
{ message: { such: 'object' }, channel: 'ch1', storeInHistory: false, customMessageType: 'test-message-type' },
(status, response) => {
try {
assert.equal(status.error, false, `Message publish error: ${JSON.stringify(status.errorData)}`);
assert(response !== null);
assert.deepEqual(response.timetoken, '14647523059145592');
assert.equal(scope.isDone(), true);
done();
} catch (error) {
done(error);
}
},
);
});

it('publishes a complex object via POST', (done) => {
Expand Down

0 comments on commit 7c3596a

Please sign in to comment.