Last active
September 30, 2017 21:13
-
-
Save CharlieHess/4df00ef65ed43a32b4a7708d2be59e3b to your computer and use it in GitHub Desktop.
A test for the workspace usage epic
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 { rxSandbox } from 'rx-sandbox'; | |
import { tallyWorkspaceUsageEpic } from '../epics/tally-workspace-usage'; | |
describe('tallyWorkspaceUsageEpic', () => { | |
it('should accumulate time until the app is quit', () => { | |
const { hot, flush, getMessages, e } = rxSandbox.create(); | |
const w = { type: WORKSPACE.SELECTION_CHANGED, payload: 'Hiro' }; | |
const x = { type: WORKSPACE.SELECTION_CHANGED, payload: 'Fiona' }; | |
const y = { type: WORKSPACE.SELECTION_CHANGED, payload: 'Da5id' }; | |
const z = { type: APP.QUIT }; | |
const usageAction = { | |
type: WORKSPACE.UPDATE_USAGE, | |
payload: { 'Hiro': 60, 'Fiona': 40, 'Da5id': 20 } | |
}; | |
const action$ = hot('w-----x---y-z', { w, x, y, z }); | |
const expected = e( '------------(x|)', { x: usageAction }); | |
const result = getMessages( | |
tallyWorkspaceUsageEpic(action$, store) | |
); | |
flush(); | |
expect(result).to.deep.equal(expected); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment