Skip to content
This repository has been archived by the owner on Jun 26, 2022. It is now read-only.

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Temmyogunbo committed Oct 27, 2019
1 parent 3cb7398 commit f8c6a6a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
"last 3 Chrome versions"
],
"devDependencies": {
"@mujo/jest-webextension-mock": "^3.5.0",
"@mujo/jest-webextension-mock": "^3.5.1",
"babel-loader": "^8.0.6",
"change-case": "^3.1.0",
"cosmiconfig": "^5.2.1",
Expand Down
2 changes: 2 additions & 0 deletions packages/extension/src/background.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const {
webNavigation,
notifications,
browserAction,
tabs,
} = Extension
jest.mock('./background/alarm')
jest.mock('universal-analytics')
Expand All @@ -25,6 +26,7 @@ test('all the automatic setup of background', async () => {
expect(webNavigation.onCommitted.addListener).toBeCalled()
expect(notifications.onClicked.addListener).toBeCalled()
expect(browserAction.onClicked.addListener).toBeCalled()
expect(tabs.onCreated.addListener).toBeCalled()

// happens in a promise chain now so its deferred
expect(initAlarms).toBeCalled()
Expand Down
4 changes: 2 additions & 2 deletions packages/extension/src/background/conditional-new-tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Extension } from '@mujo/utils'
import { NEW_TAB, CONDITIONAL_NEW_TAB_PAGE_KEY } from '../constants'
import { storage } from './storage'

const { tabs, extension } = Extension
const { tabs, runtime } = Extension

export const onConditionalNewTab = async tab => {
const isEnabled = await storage.get(CONDITIONAL_NEW_TAB_PAGE_KEY)
Expand All @@ -11,7 +11,7 @@ export const onConditionalNewTab = async tab => {
if (isEnabled || isEnabled === undefined) {
tabs.update(
tab.id,
{ url: extension.getURL('../index.html') },
{ url: runtime.getURL('../index.html') },
() => {}
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ beforeEach(() => {
storage.get = jest.fn()
storage.set = jest.fn()
tabs.update = jest.fn()
Extension.runtime.getURL = jest.fn()
})

test('conditional new tab should update if settings is true', async () => {
Expand Down

0 comments on commit f8c6a6a

Please sign in to comment.