-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
STSMACOM-787: Advanced search handle case when name of match operator…
… is a part of value (#1411) * STSMACOM-787 Export new `advancedSearchQueryToRows` helper to be used in Inventory app to reduce code duplication * STSMACOM-787 Advanced search handle case when name of match operator is a part of value
- Loading branch information
1 parent
dbb6c43
commit a7451e9
Showing
2 changed files
with
47 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import React from 'react'; | ||
import { | ||
describe, | ||
it, | ||
} from 'mocha'; | ||
import { expect } from 'chai'; | ||
|
||
import advancedSearchQueryToRows from '../advancedSearchQueryToRows'; | ||
|
||
describe('advancedSearchQueryToRows', () => { | ||
describe('when query contains multiple rows', () => { | ||
it('should parse query correctly', () => { | ||
const query = 'keyword exactPhrase value1 or keyword exactPhrase value2'; | ||
|
||
expect(advancedSearchQueryToRows(query)).to.have.deep.members([{ | ||
query: 'value1', | ||
bool: '', | ||
searchOption: 'keyword', | ||
match: 'exactPhrase', | ||
}, { | ||
query: 'value2', | ||
bool: 'or', | ||
searchOption: 'keyword', | ||
match: 'exactPhrase', | ||
}]); | ||
}); | ||
}); | ||
|
||
describe('when query contains match option as part of value', () => { | ||
it('should parse query correctly', () => { | ||
const query = 'keyword containsAny containsAny1'; | ||
|
||
expect(advancedSearchQueryToRows(query)).to.deep.include({ | ||
query: 'containsAny1', | ||
bool: '', | ||
searchOption: 'keyword', | ||
match: 'containsAny', | ||
}); | ||
}); | ||
}); | ||
}); |