diff options
Diffstat (limited to 'spec/frontend/filtered_search/stores/recent_searches_store_spec.js')
-rw-r--r-- | spec/frontend/filtered_search/stores/recent_searches_store_spec.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/frontend/filtered_search/stores/recent_searches_store_spec.js b/spec/frontend/filtered_search/stores/recent_searches_store_spec.js index 56bb82ae941..320aaa99bcc 100644 --- a/spec/frontend/filtered_search/stores/recent_searches_store_spec.js +++ b/spec/frontend/filtered_search/stores/recent_searches_store_spec.js @@ -44,6 +44,15 @@ describe('RecentSearchesStore', () => { expect(store.state.recentSearches).toEqual(['baz', 'qux']); }); + it('handles non-string values', () => { + store.setRecentSearches(['foo ', { foo: 'bar' }, { foo: 'bar' }, ['foobar']]); + + // 1. String values will be trimmed of leading/trailing spaces + // 2. Comparison will account for objects to remove duplicates + // 3. Old behaviour of handling string values stays as it is. + expect(store.state.recentSearches).toEqual(['foo', { foo: 'bar' }, ['foobar']]); + }); + it('only keeps track of 5 items', () => { store.setRecentSearches(['1', '2', '3', '4', '5', '6', '7']); |