aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/tests/apps/code/store-test.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/sonar-web/tests/apps/code/store-test.js')
-rw-r--r--server/sonar-web/tests/apps/code/store-test.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/server/sonar-web/tests/apps/code/store-test.js b/server/sonar-web/tests/apps/code/store-test.js
index 9d3445cf0af..9f883e7f8c6 100644
--- a/server/sonar-web/tests/apps/code/store-test.js
+++ b/server/sonar-web/tests/apps/code/store-test.js
@@ -4,6 +4,8 @@ import { current, bucket, initialState } from '../../../src/main/js/apps/code/re
import {
initComponentAction,
browseAction,
+ searchAction,
+ updateQueryAction,
startFetching,
stopFetching
} from '../../../src/main/js/apps/code/actions';
@@ -179,6 +181,32 @@ describe('Code :: Store', () => {
.to.have.length(1);
});
});
+ describe('searchResults', () => {
+ it('should be set', () => {
+ const results = [{ key: 'A' }, { key: 'B' }];
+ expect(current(initialState, searchAction(results)).searchResults)
+ .to.deep.equal(results)
+ });
+
+ it('should be reset', () => {
+ const results = [{ key: 'A' }, { key: 'B' }];
+ const stateBefore = Object.assign({}, initialState, { searchResults: results });
+ expect(current(stateBefore, browseAction(exampleComponent)).searchResults)
+ .to.be.null;
+ });
+ });
+ describe('searchQuery', () => {
+ it('should be set', () => {
+ expect(current(initialState, updateQueryAction('query')).searchQuery)
+ .to.equal('query');
+ });
+
+ it('should be reset', () => {
+ const stateBefore = Object.assign({}, initialState, { searchQuery: 'query' });
+ expect(current(stateBefore, browseAction(exampleComponent)).searchQuery)
+ .to.equal('');
+ });
+ });
});
describe('bucket', () => {
it('should add initial component', () => {