| 132 | const latestExtra = ctx.activity.latest_reactions_extra; |
| 133 | latestExtra.should.have.all.keys(keys); |
| 134 | const checkQuery = (extra, kind, reactions, withUser) => { |
| 135 | extra.next.should.be.a('string'); |
| 136 | extra.next.slice(0, 4).should.eql('http'); |
| 137 | const expectedQuery = { |
| 138 | id_lt: reactions[4].id, |
| 139 | limit: '5', |
| 140 | withOwnChildren: 'false', |
| 141 | }; |
| 142 | if (withUser) { |
| 143 | expectedQuery.user_id = ctx.bob.userId; |
| 144 | } |
| 145 | |
| 146 | const parsedUrl = new URL(extra.next, 'http://localhost'); |
| 147 | const query = Object.fromEntries(parsedUrl.searchParams.entries()); |
| 148 | latestExtra[kind].next.should.include('/activity_id/'); |
| 149 | latestExtra[kind].next.should.include(`/${kind}/`); |
| 150 | latestExtra[kind].next.should.include(`/${ctx.activity.id}/`); |
| 151 | expect(query).to.eql(expectedQuery); |
| 152 | }; |
| 153 | checkQuery(latestExtra.like, 'like', likes); |
| 154 | checkQuery(latestExtra.comment, 'comment', comments); |
| 155 | checkQuery(latestExtra.clap, 'clap', claps); |