Skip to content
This repository was archived by the owner on Aug 14, 2019. It is now read-only.

Commit b03e1dc

Browse files
committed
add test for query with multiple filter
1 parent 3276ee1 commit b03e1dc

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

test/rtdbLink.spec.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,29 @@ describe('rtdbLink', () => {
267267
expect(data.articles.length).to.be.equal(2);
268268
});
269269

270+
it('should query array with startAt & limitToFirst', async () => {
271+
const query = gql`
272+
query($ref: string) {
273+
articles @rtdbQuery(ref: $ref, orderByChild: "count", startAt: 2, limitToFirst: 2) @array {
274+
id @key
275+
count,
276+
title
277+
}
278+
}
279+
`;
280+
281+
const {data} = await makePromise<Result>(
282+
execute(link, {
283+
operationName: 'query',
284+
query,
285+
variables: {ref: `${TEST_NAMESPACE}/articles`}
286+
}),
287+
);
288+
expect(data.articles[0].count < data.articles[1].count).to.be.true;
289+
expect(data.articles.length).to.be.equal(2);
290+
expect(data.articles[0].count).to.be.equal(2);
291+
});
292+
270293
it('should query nested array', async () => {
271294
const query = gql`
272295
query($ref: string) {

0 commit comments

Comments
 (0)