-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Let renderer handle $expr mongo queries
Jira ticket: CAMS-421 Co-authored-by: Brian Posey <[email protected]>
- Loading branch information
1 parent
1330e93
commit fc58505
Showing
4 changed files
with
80 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { toMongoQuery } from './mongo-query-renderer'; | ||
import QueryBuilder from '../../../../query/query-builder'; | ||
import { SyncedCase } from '../../../../../../common/src/cams/cases'; | ||
|
||
describe('foo', () => { | ||
const { greaterThan } = QueryBuilder; | ||
test('should do the thing', () => { | ||
const expected = { | ||
$expr: { | ||
$gt: ['$closedDate', '$reopenedDate'], | ||
}, | ||
}; | ||
|
||
expect( | ||
toMongoQuery( | ||
QueryBuilder.build(greaterThan<SyncedCase['closedDate']>('closedDate', 'reopenedDate')), | ||
true, | ||
), | ||
).toEqual(expected); | ||
|
||
const expected2 = { | ||
closedDate: { | ||
$gt: '2025-01-01', | ||
}, | ||
}; | ||
expect( | ||
toMongoQuery( | ||
QueryBuilder.build(greaterThan<SyncedCase['closedDate']>('closedDate', '2025-01-01')), | ||
), | ||
).toEqual(expected2); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters