Skip to content

Commit

Permalink
tests: add missing unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ghiscoding committed Mar 5, 2021
1 parent 6bca5c9 commit 7ca5637
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,20 @@ describe('executeStringFilterCondition method', () => {
expect(output).toBe(true);
});

it('should return False when search term is a substring of the cell value and the operator is "<>" (not contains)', () => {
const searchTerms = ['bost'];
const options = { dataKey: '', operator: '<>', cellValue: 'abbostford', fieldType: FieldType.string, searchTerms } as FilterConditionOption;
const output = executeStringFilterCondition(options, getFilterParsedText(searchTerms));
expect(output).toBe(false);
});

it('should return True when search term is a substring of the cell value and the operator is "!=" (not contains) because "!=" compares agains the entire string', () => {
const searchTerms = ['bost'];
const options = { dataKey: '', operator: '!=', cellValue: 'abbostford', fieldType: FieldType.string, searchTerms } as FilterConditionOption;
const output = executeStringFilterCondition(options, getFilterParsedText(searchTerms));
expect(output).toBe(true);
});

it('should return True when input value provided starts with same substring and the operator is empty string', () => {
const searchTerms = ['abb'];
const options = { dataKey: '', operator: '', cellValue: 'abbostford', fieldType: FieldType.string, searchTerms } as FilterConditionOption;
Expand Down

0 comments on commit 7ca5637

Please sign in to comment.