Skip to content

Commit 849fd59

Browse files
add test for or operator
1 parent d12ea25 commit 849fd59

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

test/index.test.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ describe('filter', () => {
673673
expect(actual).toEqual(expected);
674674
})
675675

676-
it('should support "in" operator on a collection with an array/collection parameter of a strings', () => {
676+
it('should handle collection operator with "in" operator on the item of a simple collection', () => {
677677
const filter = {
678678
tags: {
679679
any: {
@@ -685,6 +685,24 @@ describe('filter', () => {
685685
const actual = buildQuery({ filter });
686686
expect(actual).toEqual(expected);
687687
})
688+
689+
690+
it('should handle collection operator with "or" operator on the item of a simple collection', () => {
691+
const filter = {
692+
tags: {
693+
any: {
694+
or: [
695+
{ [ITEM_ROOT]: 'tag1'},
696+
{ [ITEM_ROOT]: 'tag2'},
697+
]
698+
}
699+
}
700+
};
701+
702+
const expected = "?$filter=tags/any(tags:((tags eq 'tag1') or (tags eq 'tag2')))";
703+
const actual = buildQuery({ filter });
704+
expect(actual).toEqual(expected);
705+
})
688706
});
689707

690708
describe('data types', () => {

0 commit comments

Comments
 (0)