Created
October 1, 2017 15:20
-
-
Save KTruong008/9514d1900a1ef4eb743fcbf7fd73c25a to your computer and use it in GitHub Desktop.
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'; | |
import { | |
selectAuthenticated, | |
} from '../login.selectors'; | |
describe('Login Selectors', () => { | |
describe('selectAuthenticated', () => { | |
it('should return login.authenticated as boolean', () => { | |
mockParameters = { | |
login: { | |
authenticated: false, | |
authenticating: false, | |
}, | |
}; | |
const selected = selectAuthenticated.resultFunc(mockParameters.login); | |
expect(type(selected)).toEqual('Boolean'); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In this example what are the type definitions for
AppStateT
andLoginStateT
?