Skip to content

Commit

Permalink
add more unit tests for order by normalization
Browse files Browse the repository at this point in the history
  • Loading branch information
milaGGL committed Aug 17, 2023
1 parent 642186c commit 226a754
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions packages/firestore/test/unit/core/query.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,7 @@ describe('Query', () => {
query(
'foo',
filter('a', '<', 5),
filter('a', '>=', 5),
filter('aa', '>', 5),
filter('b', '>', 5),
filter('A', '>', 5)
Expand Down Expand Up @@ -869,6 +870,50 @@ describe('Query', () => {
orderBy('d'),
orderBy(DOCUMENT_KEY_NAME)
);

// OrderBy
assertImplicitOrderBy(
query(
'foo',
filter('b', '<', 5),
filter('a', '>', 5),
filter('z', '>', 5),
orderBy('z')
),
orderBy('z'),
orderBy('a'),
orderBy('b'),
orderBy(DOCUMENT_KEY_NAME)
);

// last explicit order by direction
assertImplicitOrderBy(
query(
'foo',
filter('b', '<', 5),
filter('a', '>', 5),
orderBy('z', 'desc')
),
orderBy('z', 'desc'),
orderBy('a', 'desc'),
orderBy('b', 'desc'),
orderBy(DOCUMENT_KEY_NAME, 'desc')
);

assertImplicitOrderBy(
query(
'foo',
filter('b', '<', 5),
filter('a', '>', 5),
orderBy('z', 'desc'),
orderBy('c')
),
orderBy('z', 'desc'),
orderBy('c'),
orderBy('a'),
orderBy('b'),
orderBy(DOCUMENT_KEY_NAME)
);
});

it('matchesAllDocuments() considers filters, orders and bounds', () => {
Expand Down

0 comments on commit 226a754

Please sign in to comment.