[FIX] Empty results on `im.list` endpoint (#26438)

Co-authored-by: Diego Sampaio <8591547+sampaiodiego@users.noreply.github.com>
pull/26447/head
Fábio Albuquerque 4 years ago committed by GitHub
parent 133aa101d7
commit f5558892d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      apps/meteor/app/api/server/v1/im.ts
  2. 29
      apps/meteor/tests/end-to-end/api/04-direct-message.js

@ -434,7 +434,7 @@ API.v1.addRoute(
.toArray();
const { cursor, totalCount } = Rooms.findPaginated(
{ type: 'd', _id: { $in: subscriptions } },
{ t: 'd', _id: { $in: subscriptions } },
{
sort,
skip: offset,
@ -451,7 +451,7 @@ API.v1.addRoute(
return API.v1.success({
ims,
offset,
count,
count: ims.length,
total,
});
},

@ -188,8 +188,18 @@ describe('[Direct Messages]', function () {
.expect(200)
.expect((res) => {
expect(res.body).to.have.property('success', true);
expect(res.body).to.have.property('count');
expect(res.body).to.have.property('total');
expect(res.body).to.have.property('count', 1);
expect(res.body).to.have.property('total', 1);
expect(res.body).to.have.property('ims').and.to.be.an('array');
const im = res.body.ims[0];
expect(im).to.have.property('_id');
expect(im).to.have.property('t').and.to.be.eq('d');
expect(im).to.have.property('msgs').and.to.be.a('number');
expect(im).to.have.property('usernames').and.to.be.an('array');
expect(im).to.have.property('lm');
expect(im).to.have.property('_updatedAt');
expect(im).to.have.property('ts');
expect(im).to.have.property('lastMessage');
})
.end(done);
});
@ -202,8 +212,19 @@ describe('[Direct Messages]', function () {
.expect(200)
.expect((res) => {
expect(res.body).to.have.property('success', true);
expect(res.body).to.have.property('count');
expect(res.body).to.have.property('total');
expect(res.body).to.have.property('count', 1);
expect(res.body).to.have.property('total', 1);
expect(res.body).to.have.property('ims').and.to.be.an('array');
const im = res.body.ims[0];
expect(im).to.have.property('_id');
expect(im).to.have.property('t').and.to.be.eq('d');
expect(im).to.have.property('msgs').and.to.be.a('number');
expect(im).to.have.property('usernames').and.to.be.an('array');
expect(im).to.have.property('ro');
expect(im).to.have.property('sysMes');
expect(im).to.have.property('_updatedAt');
expect(im).to.have.property('ts');
expect(im).to.have.property('lastMessage');
})
.end(done);
});

Loading…
Cancel
Save