Skip to content

Commit

Permalink
fix(firestore) Added test case for orderby before where query
Browse files Browse the repository at this point in the history
  • Loading branch information
dackers86 authored and mikehardy committed Nov 10, 2020
1 parent 6a8f8ad commit 4a548cd
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions packages/firestore/e2e/Query/where.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -569,4 +569,23 @@ describe('firestore().collection().where()', () => {

return Promise.resolve();
});

it('should handle where clause after sort by', async () => {
const ref = firebase.firestore().collection(`${COLLECTION}/filter/sort-by-where`);

await ref.add({ status: 1 });
await ref.add({ status: 2 });
await ref.add({ status: 3 });

const items = [];
await ref
.orderBy('status', 'desc')
.where('status', '<=', 2)
.get()
.then($ => $.forEach(doc => items.push(doc.data())));

items.length.should.equal(2);
items[0].status.should.equal(2);
items[1].status.should.equal(1);
});
});

0 comments on commit 4a548cd

Please sign in to comment.