From 120474ec6a4744e111eb06fb26d1638a7fb0eb6c Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 30 Oct 2018 21:55:16 +0900 Subject: Fix bug --- test/api.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'test/api.ts') diff --git a/test/api.ts b/test/api.ts index 1bb8e20b17..6debea4d12 100644 --- a/test/api.ts +++ b/test/api.ts @@ -508,6 +508,24 @@ describe('API', () => { }, me); expect(res).have.status(400); })); + + it('同じユーザーに複数メンションしても内部的にまとめられる', async(async () => { + const alice = await signup({ username: 'alice' }); + const bob = await signup({ username: 'bob' }); + const post = { + text: '@bob @bob @bob yo' + }; + + const res = await request('/notes/create', post, alice); + + expect(res).have.status(200); + expect(res.body).be.a('object'); + expect(res.body).have.property('createdNote'); + expect(res.body.createdNote).have.property('text').eql(post.text); + + const noteDoc = await db.get('notes').findOne({ _id: res.body.createdNote.id }); + expect(noteDoc.mentions.map((id: any) => id.toString())).eql([bob.id.toString()]); + })); }); describe('notes/show', () => { -- cgit v1.2.3-freya