Skip to content

Commit 53a7c8c

Browse files
aiskleeyeh
authored andcommitted
test: add system conversation send test
1 parent 4abdd8c commit 53a7c8c

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/conversation.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ module.exports = AV.Object.extend('_Conversation', {
125125
transient: false,
126126
message: message,
127127
};
128-
if (options.toClientIds !== undefined) {
129-
data.to_peers = toClients;
128+
if (options.toClients !== undefined) {
129+
data.to_peers = options.toClients;
130130
}
131131
if (options.transient !== undefined) {
132132
data.transient = options.transient ? true : false;

test/conversation.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,16 @@ describe('Conversation', () => {
2424
return conv.send('admin', 'test test test!', {}, { useMasterKey: true });
2525
});
2626
});
27+
28+
it('should send a realtime message to the system conversation', () => {
29+
const conv = new AV.Conversation('system', { isSystem: true });
30+
return conv.save().then(() => {
31+
return conv.send('admin', 'test system conversation !', {
32+
toClients: ['user1', 'user2']
33+
}, {
34+
useMasterKey: true,
35+
});
36+
});
37+
});
2738
})
2839
});

0 commit comments

Comments
 (0)