blob: e87782bf0dda9a6989cc93bec2fb7efa0a93f172 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
import sinon from "sinon";
import ReloadTabOperator from "../../../../src/background/operators/impls/ReloadTabOperator";
import MockTabPresenter from "../../mock/MockTabPresenter";
describe("ReloadTabOperator", () => {
describe("#run", () => {
it("reloads the current tab with cache", async () => {
const tabPresenter = new MockTabPresenter();
await tabPresenter.create("https://example.com/", { active: true });
await tabPresenter.create("https://example.com/", { active: false });
const mock = sinon.mock(tabPresenter).expects("reload").withArgs(0, true);
const sut = new ReloadTabOperator(tabPresenter, true);
await sut.run();
mock.verify();
});
it("reloads the current tab without cache", async () => {
const tabPresenter = new MockTabPresenter();
await tabPresenter.create("https://example.com/", { active: true });
await tabPresenter.create("https://example.com/", { active: false });
const mock = sinon
.mock(tabPresenter)
.expects("reload")
.withArgs(0, false);
const sut = new ReloadTabOperator(tabPresenter, false);
await sut.run();
mock.verify();
});
});
});
|