parent
6d057a974b
commit
1f51f3260d
2 changed files with 35 additions and 0 deletions
@ -0,0 +1,13 @@ |
|||||||
|
import actions from 'background/actions'; |
||||||
|
import * as tabActions from 'background/actions/tab'; |
||||||
|
|
||||||
|
describe("tab actions", () => { |
||||||
|
describe("selected", () => { |
||||||
|
it('create TAB_SELECTED action', () => { |
||||||
|
let action = tabActions.selected(123); |
||||||
|
expect(action.type).to.equal(actions.TAB_SELECTED); |
||||||
|
expect(action.tabId).to.equal(123); |
||||||
|
}); |
||||||
|
}); |
||||||
|
}); |
||||||
|
|
@ -0,0 +1,22 @@ |
|||||||
|
import actions from 'background/actions'; |
||||||
|
import tabReducer from 'background/reducers/tab'; |
||||||
|
|
||||||
|
describe("tab reducer", () => { |
||||||
|
it('return the initial state', () => { |
||||||
|
let state = tabReducer(undefined, {}); |
||||||
|
expect(state.previousSelected).to.equal(-1); |
||||||
|
expect(state.currentSelected).to.equal(-1); |
||||||
|
}); |
||||||
|
|
||||||
|
it('return next state for TAB_SELECTED', () => { |
||||||
|
let state = undefined; |
||||||
|
|
||||||
|
state = tabReducer(state, { type: actions.TAB_SELECTED, tabId: 123 }); |
||||||
|
expect(state.previousSelected).to.equal(-1); |
||||||
|
expect(state.currentSelected).to.equal(123); |
||||||
|
|
||||||
|
state = tabReducer(state, { type: actions.TAB_SELECTED, tabId: 456 }); |
||||||
|
expect(state.previousSelected).to.equal(123); |
||||||
|
expect(state.currentSelected).to.equal(456); |
||||||
|
}); |
||||||
|
}); |
Reference in new issue