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
import { path, find, propEq } from 'ramda'; | |
import { createSelector } from 'reselect'; | |
import { | |
AppStateT, | |
UserProfileT, | |
BusinessNameSearchesT, | |
BusinessNameSearchesSearchesT, | |
UserDetailsT, | |
PaymentOrderT, | |
BUSINESS_REGISTRATION_STATUS, |
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
import { createStructuredSelector, createSelector } from 'reselect'; | |
import { getFormValues } from 'redux-form'; | |
import { FORM_NAMES } from '../../core/types'; | |
export const selectBusinessNameRegistrationFormValues = createSelector( | |
getFormValues(FORM_NAMES.BUSINESS_NAME_REGISTRATION), | |
formValues => formValues | |
); | |
export const businessNameRegistrationFormConnector = createStructuredSelector({ |
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
import React from 'react'; | |
import Link from '../Link.react'; | |
import renderer from 'react-test-renderer'; | |
it('renders correctly', () => { | |
const tree = renderer.create( | |
<Link page="http://www.facebook.com">Facebook</Link> | |
).toJSON(); | |
expect(tree).toMatchSnapshot(); | |
}); |
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
describe('loginSuccessEpic', () => { | |
it('dispatches actions to change location, authenticated, and stopSubmit', () => { | |
const action = ActionsObservable.of({ | |
type: LOGIN_TYPES.SUCCESS, | |
payload: [{}, {}] | |
}); | |
loginSuccessEpic(action, {}) | |
.toArray() | |
.subscribe((outputActions) => { | |
expect(outputActions).toEqual([ |
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
export const loginSuccessEpic = ( | |
action$, | |
store | |
) => action$ | |
.ofType(LOGIN_TYPES.SUCCESS) | |
.mergeMap(() => { | |
return Observable.from([ | |
location.createRouteChangeAction( | |
LOCATION.USER_DASHBOARD | |
), |
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
// selectors.js | |
export const selectLogin = (state: AppStateT) => state.login; | |
export const selectAuthenticated = createSelector( | |
selectLogin, | |
(loginState: LoginStateT) => loginState.authenticated | |
); | |
// selectors.test.js | |
import { type } from 'ramda'; |
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
import { createSelector } from 'reselect' | |
const shopItemsSelector = state => state.shop.items | |
const subtotalSelector = createSelector( | |
shopItemsSelector, | |
items => items.reduce((acc, item) => acc + item.value, 0) | |
) | |
let exampleState = { |
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
// reducer.js | |
export const initialState = { | |
authenticated: false, | |
authenticating: false, | |
}; | |
export const loginReducer = ( | |
state = initialState, | |
action | |
) => { |
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
import React from 'react'; | |
export const SomeComponent = () => { | |
return ( | |
<div className="flex justify-center items-center"> | |
what | |
</div> | |
); | |
} |
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
.someClassName { | |
display: flex; | |
justify-content: center; | |
align-items: center; | |
} |