Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
fix extension state tests
Browse files Browse the repository at this point in the history
auditors: @bbondy
  • Loading branch information
bridiver committed Sep 13, 2016
1 parent 46f87a6 commit 4cebfe6
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions test/unit/common/state/extensionStateTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,22 +274,26 @@ describe('extensionState', function () {
})

describe('getBrowserActionByTabId', function () {
before(function () {
this.state = defaultAppState.setIn(['extensions', 'abcd'],
abcdBrowserAction.setIn(['browserAction', 'tabs', '1'], Immutable.fromJS({
title: 'tabTitle'
})))
})

describe('without tab-specific properties', function () {
before(function () {
this.state = defaultAppState.setIn(['extensions', 'abcd'], abcdBrowserAction)
this.browserAction = extensionState.getBrowserActionByTabId(this.state, 'abcd', '1')
})

it('should return the default browserAction properties', function () {
assert(Immutable.is(this.browserAction, abcdBrowserAction.get('browserAction')))
assert.equal(this.browserAction.get('title'), abcdBrowserAction.getIn(['browserAction', 'title']))
assert.equal(this.browserAction.get('popup'), abcdBrowserAction.getIn(['browserAction', 'popup']))
})
})

describe('with tab-specific properties', function () {
before(function () {
this.state = defaultAppState.setIn(['extensions', 'abcd'], abcdBrowserAction.setIn(['browserAction', 'tabs', '1'], Immutable.fromJS({
title: 'tabTitle'
})))
this.browserAction = extensionState.getBrowserActionByTabId(this.state, 'abcd', '1')
})

Expand All @@ -301,12 +305,14 @@ describe('extensionState', function () {

describe('no browser action for the extensionId', function () {
before(function () {
this.state = defaultAppState.setIn(['extensions', 'abcd'], abcdBrowserAction)
this.browserAction = extensionState.getBrowserActionByTabId(this.state, 'abcd', '1')
let state = this.state.setIn(['extensions', 'abcde'], Immutable.fromJS({}))
this.browserAction1 = extensionState.getBrowserActionByTabId(state, 'abcde', '1')
this.browserAction2 = extensionState.getBrowserActionByTabId(state, 'abcdef', '1')
})

it('should return null', function () {
assert(this.browserAction, null)
assert.equal(this.browserAction1, null)
assert.equal(this.browserAction2, null)
})
})
})
Expand Down

1 comment on commit 4cebfe6

@bbondy
Copy link
Member

@bbondy bbondy commented on 4cebfe6 Sep 13, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++

Please sign in to comment.