Skip to content

Commit a01c65c

Browse files
author
Marco Franceschi
committed
chore: Included unit tests for contains and doesnotcontain operators
1 parent 6ff42ca commit a01c65c

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tests/operators/array.test.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,28 @@ describe('Array Operators', () => {
2828
expect(ArrayOperators.notIn('rule', [])).toBeTruthy()
2929
})
3030
})
31+
32+
describe('Contains Operator', () => {
33+
test('Should pass given a filled array with the searched element', () => {
34+
expect(ArrayOperators.contains(['*', 'rule'], '*')).toBeTruthy()
35+
})
36+
37+
test('Should fail given a filled array without the searched element', () => {
38+
expect(ArrayOperators.contains(['*', 'rule'], 'x')).toBeFalsy()
39+
})
40+
41+
test('Should fail given an empty array', () => {
42+
expect(ArrayOperators.contains([], 'x')).toBeFalsy()
43+
})
44+
})
45+
46+
describe('DoesNotContain Operator', () => {
47+
test('Should fail given a filled array with the searched element', () => {
48+
expect(ArrayOperators.doesNotContain(['rule'], 'rule')).toBeFalsy()
49+
})
50+
51+
test('Should pass given a filled array without the searched element', () => {
52+
expect(ArrayOperators.doesNotContain(['*'], 'rule')).toBeTruthy()
53+
})
54+
})
3155
})

0 commit comments

Comments
 (0)