From 9838522bbf25c8943cf494a4e72458a0983ec684 Mon Sep 17 00:00:00 2001 From: therynamo Date: Sun, 17 May 2020 07:07:55 -0500 Subject: [PATCH] feat: Add reload to tabs --- __tests__/tabs.test.js | 9 +++++++++ src/tabs.js | 1 + 2 files changed, 10 insertions(+) diff --git a/__tests__/tabs.test.js b/__tests__/tabs.test.js index 6308c8f..1bafbdb 100644 --- a/__tests__/tabs.test.js +++ b/__tests__/tabs.test.js @@ -103,4 +103,13 @@ describe('browser.tabs', () => { expect(callback).toHaveBeenCalledTimes(0); }); }); + test('reload', (done) => { + const callback = jest.fn(() => done()); + expect(jest.isMockFunction(chrome.tabs.reload)).toBe(true); + + chrome.tabs.reload(1, {}, callback); + + expect(chrome.tabs.reload).toHaveBeenCalledTimes(1); + expect(callback).toHaveBeenCalledTimes(1); + }); }); diff --git a/src/tabs.js b/src/tabs.js index 8385fc3..508b180 100644 --- a/src/tabs.js +++ b/src/tabs.js @@ -45,4 +45,5 @@ export const tabs = { hasListener: jest.fn(), }, sendMessage: jest.fn(), + reload: jest.fn((tabId, reloadProperties, cb) => cb()), };