-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* test: util base * chore: upgrade dev deps * test: coverage * chore: setup sinon chrome * chore: absolute imports for test * test: setup chrome * chore: setup types dir * test: chrome tabs * test: add sinon chrome type def * test: windows * fix: use window position for move * test: window positioning * test: declare sinon chrome module * refactor: skip undefined windows in compare * test: get selected tabs in window * test: cover last branch chrome utils * chore: some clean up * test: wip background handler * test: move action with active tabs * test: move to window fail handle * test: undoes last action * test: jest mock prop * test: undo limit * test: actions * refactor: single listener * test: background index * test: options page * test: background index missing branches
- Loading branch information
Showing
25 changed files
with
957 additions
and
884 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import * as chrome from "sinon-chrome"; | ||
|
||
Object.assign(global, { chrome }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
declare module "jest-mock-props"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
declare module "sinon-chrome"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`actions move tabs creates valid action with no source 1`] = ` | ||
Object { | ||
"payload": Object { | ||
"from": undefined, | ||
"tabs": Array [ | ||
Object { | ||
"id": 33, | ||
}, | ||
Object { | ||
"id": 22, | ||
}, | ||
Object { | ||
"id": 11, | ||
}, | ||
], | ||
"to": 2, | ||
}, | ||
"type": "move-tabs", | ||
} | ||
`; | ||
|
||
exports[`actions move tabs creates valid action with no target 1`] = ` | ||
Object { | ||
"payload": Object { | ||
"from": 1, | ||
"tabs": Array [ | ||
Object { | ||
"id": 33, | ||
}, | ||
Object { | ||
"id": 22, | ||
}, | ||
Object { | ||
"id": 11, | ||
}, | ||
], | ||
"to": null, | ||
}, | ||
"type": "move-tabs", | ||
} | ||
`; | ||
|
||
exports[`actions move tabs fails to create invalid action for tabs: 1`] = `"Invalid Action Definition: move (1 => 2)"`; | ||
|
||
exports[`actions move tabs fails to create invalid action for tabs:null 1`] = `"Invalid Action Definition: move null (1 => 2)"`; | ||
|
||
exports[`actions move tabs fails to create invalid action for tabs:undefined 1`] = `"Invalid Action Definition: move undefined (1 => 2)"`; | ||
|
||
exports[`actions undo creates valid action 1`] = ` | ||
Object { | ||
"type": "undo", | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { moveTabs, undo } from "background/actions"; | ||
|
||
describe("actions", () => { | ||
describe("move tabs", () => { | ||
const tabIds = [33, 22, 11]; | ||
const mockTabs = tabIds.map(id => ({ id } as ChromeTab)); | ||
|
||
it("creates valid action with no target", () => { | ||
expect(moveTabs({ tabs: mockTabs, from: 1 })).toMatchSnapshot(); | ||
}); | ||
|
||
it("creates valid action with no source", () => { | ||
expect(moveTabs({ tabs: mockTabs, to: 2 })).toMatchSnapshot(); | ||
}); | ||
|
||
it.each([null, undefined, []].map(v => [v]))( | ||
"fails to create invalid action for tabs:%s", | ||
async tabs => { | ||
expect(() => { | ||
moveTabs({ tabs, from: 1, to: 2 }); | ||
}).toThrowErrorMatchingSnapshot(); | ||
}, | ||
); | ||
}); | ||
|
||
describe("undo", () => { | ||
it("creates valid action", () => { | ||
expect(undo()).toMatchSnapshot(); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.