-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
STCOM-1242: Doesn't replace an unsupported search option if the advan…
…ced search modal is not open. (#2189)
- Loading branch information
1 parent
4b8de30
commit f45e806
Showing
7 changed files
with
63 additions
and
4 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
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,48 @@ | ||
import { | ||
describe, | ||
it, | ||
} from 'mocha'; | ||
import { expect } from 'chai'; | ||
|
||
import getHookExecutionResult from "../../../../tests/helpers/getHookExecutionResult"; | ||
import useAdvancedSearch from '../useAdvancedSearch'; | ||
|
||
describe('useAdvancedSearch', () => { | ||
describe('when advanced search modal is closed', () => { | ||
it('should not replace the search option with default one', async () => { | ||
const firstRowInitialSearch = { | ||
query: "identifiers.value==n83169267", | ||
option: "advancedSearch", | ||
}; | ||
|
||
const args = { | ||
defaultSearchOptionValue: 'keyword', | ||
firstRowInitialSearch, | ||
open: false, | ||
}; | ||
|
||
const hookResult = await getHookExecutionResult(useAdvancedSearch, args); | ||
|
||
expect(hookResult.filledRows[0].searchOption).to.equal('identifiers.value'); | ||
}); | ||
}); | ||
|
||
describe('when advanced search modal is open', () => { | ||
it('should replace the search option with default one', async () => { | ||
const firstRowInitialSearch = { | ||
query: "identifiers.value==n83169267", | ||
option: "advancedSearch", | ||
}; | ||
|
||
const args = { | ||
defaultSearchOptionValue: 'keyword', | ||
firstRowInitialSearch, | ||
open: true, | ||
}; | ||
|
||
const hookResult = await getHookExecutionResult(useAdvancedSearch, args); | ||
|
||
expect(hookResult.filledRows[0].searchOption).to.equal('keyword'); | ||
}); | ||
}); | ||
}); |
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 |
---|---|---|
|
@@ -5,4 +5,5 @@ export { | |
FIELD_NAMES, | ||
BOOLEAN_OPERATORS, | ||
MATCH_OPTIONS, | ||
DEFAULT_SEARCH_OPTION, | ||
} from './constants'; |
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