MCPcopy Create free account
hub / github.com/GetStream/stream-js / checkQuery

Function checkQuery

test/integration/cloud/reaction.js:134–152  ·  view source on GitHub ↗
(extra, kind, reactions, withUser)

Source from the content-addressed store, hash-verified

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);

Callers 1

reaction.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected