-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- updateQueryState exposed withState HOC - test for exposed props form withState - documentation - fix for config expecting axios property - fix circular dependency src/lib/store.js -> src/lib/state/reducers/index.js -> src/lib/state/reducers/query.js -> src/lib/store.js - changed initialResultsState.loading to true to avoid double children render in ResultsLoader closes #101 - closes #99
- Loading branch information
Showing
11 changed files
with
104 additions
and
47 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
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,33 @@ | ||
/* | ||
* This file is part of React-SearchKit. | ||
* Copyright (C) 2020 CERN. | ||
* | ||
* React-SearchKit is free software; you can redistribute it and/or modify it | ||
* under the terms of the MIT License; see LICENSE file for more details. | ||
*/ | ||
|
||
import React from 'react'; | ||
import configureMockStore from 'redux-mock-store'; | ||
import { shallow } from 'enzyme'; | ||
import { withState } from './withState'; | ||
|
||
const mockStore = configureMockStore(); | ||
|
||
describe('withState tests', () => { | ||
let WithStateComponent; | ||
let store; | ||
beforeEach(() => { | ||
store = mockStore({}); | ||
store.clearActions(); | ||
const mockedComponent = jest.fn(); | ||
WithStateComponent = withState(mockedComponent); | ||
}); | ||
|
||
it('should find the props exposed by withState', async () => { | ||
const wrapper = shallow(<WithStateComponent store={store} />); | ||
const props = wrapper.children(0).props(); | ||
expect(props.hasOwnProperty('currentResultsState')).toBe(true); | ||
expect(props.hasOwnProperty('currentQueryState')).toBe(true); | ||
expect(props.hasOwnProperty('updateQueryState')).toBe(true); | ||
}); | ||
}); |
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,20 @@ | ||
/* | ||
* This file is part of React-SearchKit. | ||
* Copyright (C) 2018-2020 CERN. | ||
* | ||
* React-SearchKit is free software; you can redistribute it and/or modify it | ||
* under the terms of the MIT License; see LICENSE file for more details. | ||
*/ | ||
|
||
export const INITIAL_STORE_STATE = { | ||
queryString: '', | ||
suggestions: [], | ||
sortBy: null, | ||
sortOrder: null, | ||
page: 1, | ||
size: 10, | ||
filters: [], | ||
layout: null, | ||
}; | ||
|
||
export const STORE_KEYS = Object.keys(INITIAL_STORE_STATE); |