Skip to content

Commit

Permalink
test added
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristianE00 committed May 10, 2024
1 parent c800ac3 commit 1a2df0c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions worker.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,22 @@ describe('containsTab', () => {

// getCurrentTab tests
describe('getCurrentTab', () => {
// test 1
it('should return the current tab', async () => {
const mockTab = { id: 1, url: 'http://exmaple.com' };
chrome.tabs.query.mockResolvedValue([mockTab]);
const tab = await getCurrentTab();
expect(chrome.tabs.query).toHaveBeenCalledWith({ active: true, currentWindow: true});
expect(tab).toEqual(mockTab);
});

// test 2
it('should return the current tab', async () => {
const mockTab = { id: 1, url: 'https://christianewing.com' };
chrome.tabs.query.mockResolvedValue([mockTab]);
const tab = await getCurrentTab();
expect(chrome.tabs.query).toHaveBeenCalledWith({ active: true, currentWindow: true});
expect(tab).toEqual(mockTab);
});

});

0 comments on commit 1a2df0c

Please sign in to comment.