Skip to content

Commit 1d6a139

Browse files
Copilothotlong
andcommitted
test: add between and nin operator conversion tests
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent f4843d9 commit 1d6a139

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

packages/spec/src/data/filter.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -834,6 +834,14 @@ describe('parseFilterAST', () => {
834834
expect(parseFilterAST(['name', 'ends_with', '.pdf'])).toEqual({ name: { $endsWith: '.pdf' } });
835835
});
836836

837+
it('should convert between operator', () => {
838+
expect(parseFilterAST(['age', 'between', [18, 65]])).toEqual({ age: { $between: [18, 65] } });
839+
});
840+
841+
it('should convert nin operator (MongoDB alias)', () => {
842+
expect(parseFilterAST(['role', 'nin', ['guest']])).toEqual({ role: { $nin: ['guest'] } });
843+
});
844+
837845
it('should convert is_null operator', () => {
838846
expect(parseFilterAST(['deleted_at', 'is_null', null])).toEqual({ deleted_at: { $null: true } });
839847
});

0 commit comments

Comments
 (0)