Skip to content

Commit 6d5fa4d

Browse files
committed
test: Simplify the numerical comparator tests
1 parent 5efbb95 commit 6d5fa4d

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

src/features/instance/operations/queries/getSearchByConditions.test.ts

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,25 @@ describe('translateStringSearchType', () => {
2929

3030
describe('parseNumericalComparator', () => {
3131
it('understand greater than equal', () => {
32-
const myExpectations = {
32+
expect(parseNumericalComparator('>= 10')).toEqual({
3333
comparator: 'greater_than_equal',
3434
rawNumber: '10',
35-
};
36-
expect(parseNumericalComparator('>= 10')).toEqual(myExpectations);
37-
expect(parseNumericalComparator('gte 10')).toEqual(myExpectations);
38-
expect(parseNumericalComparator('gte=10')).toEqual(myExpectations);
35+
});
36+
expect(parseNumericalComparator('gte 10')).toEqual({
37+
comparator: 'greater_than_equal',
38+
rawNumber: '10',
39+
});
40+
expect(parseNumericalComparator('gte=10')).toEqual({
41+
comparator: 'greater_than_equal',
42+
rawNumber: '10',
43+
});
3944
});
4045

4146
it('supports dates', () => {
42-
const myExpectations = {
47+
expect(parseNumericalComparator('>= 2025-10-01')).toEqual({
4348
comparator: 'greater_than_equal',
4449
rawNumber: '2025-10-01',
45-
};
46-
expect(parseNumericalComparator('>= 2025-10-01')).toEqual(myExpectations);
50+
});
4751
});
4852

4953
it('throws errors with unknown operators', () => {
@@ -53,11 +57,10 @@ describe('parseNumericalComparator', () => {
5357
});
5458

5559
it('falls back to equals with pure numbers', () => {
56-
const myExpectations = {
60+
expect(parseNumericalComparator('2025')).toEqual({
5761
comparator: 'equals',
5862
rawNumber: '2025',
59-
};
60-
expect(parseNumericalComparator('2025')).toEqual(myExpectations);
63+
});
6164
});
6265
});
6366

0 commit comments

Comments
 (0)