-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1310 from smartcontractkit/bugs/fix-no-search-res…
…ults-back-history Fix search results when navigating back in history after page load
- Loading branch information
Showing
3 changed files
with
14 additions
and
26 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,23 @@ | ||
import reducer, { IState } from '../../reducers' | ||
import { SearchAction } from '../../reducers/search' | ||
import { Action } from '../../reducers/search' | ||
|
||
describe('reducers/search', () => { | ||
it('returns an initial state', () => { | ||
const action = {} as SearchAction | ||
const action = {} as Action | ||
const state = reducer({}, action) as IState | ||
|
||
expect(state.search).toEqual({ | ||
query: undefined | ||
}) | ||
}) | ||
|
||
it('can update the search query', () => { | ||
const action = { | ||
type: 'UPDATE_SEARCH_QUERY', | ||
query: 'something' | ||
} as SearchAction | ||
it('can parse the search query from a query param', () => { | ||
const location = { toString: () => 'http://localhost/?search=find-me' } | ||
const action = { location } as Action | ||
const state = reducer({}, action) as IState | ||
|
||
expect(state.search).toEqual({ | ||
query: 'something' | ||
query: 'find-me' | ||
}) | ||
}) | ||
}) |
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