From c70cbc92db84b88d6690a76fe0c0bcdca271b3c2 Mon Sep 17 00:00:00 2001 From: Diego Sampaio Date: Wed, 18 Dec 2024 12:24:52 -0300 Subject: [PATCH] add a test --- apps/meteor/tests/end-to-end/api/methods.ts | 26 +++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/apps/meteor/tests/end-to-end/api/methods.ts b/apps/meteor/tests/end-to-end/api/methods.ts index e3e8a193d799..8e4950be5127 100644 --- a/apps/meteor/tests/end-to-end/api/methods.ts +++ b/apps/meteor/tests/end-to-end/api/methods.ts @@ -2082,6 +2082,32 @@ describe('Meteor.methods', () => { }) .end(done); }); + + it('should accept message sent by js.SDK', (done) => { + void request + .post(methodCall('sendMessage')) + .set(credentials) + .send({ + message: JSON.stringify({ + method: 'sendMessage', + params: [{ rid, msg: 'test message', bot: { i: 'js.SDK' } }], + id: 1000, + msg: 'method', + }), + }) + .expect('Content-Type', 'application/json') + .expect(200) + .expect((res) => { + expect(res.body).to.have.property('success', true); + + const data = JSON.parse(res.body.message); + + expect(data).to.have.a.property('result').that.is.an('object'); + expect(data.result).to.have.a.property('bot').that.is.an('object'); + expect(data.result.bot).to.have.a.property('i', 'js.SDK'); + }) + .end(done); + }); }); describe('[@updateMessage]', () => {