Skip to content

Commit

Permalink
fix(firestore): add test case for orderby before where query (#4459)
Browse files Browse the repository at this point in the history
  • Loading branch information
dackers86 authored Nov 10, 2020
1 parent 6a8f8ad commit fdf978a
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);
});
});

1 comment on commit fdf978a

@vercel
Copy link

@vercel vercel bot commented on fdf978a Nov 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.