blob: cc77429def0308f5cc9ac1663db3ee7fa14a28cb (
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
|
import ToggleAddonOperator from "../../../../src/content/operators/impls/ToggleAddonOperator";
import MockAddonIndicatorClient from "../../mock/MockAddonIndicatorClient";
import MockAddonEnabledRepository from "../../mock/MockAddonEnabledRepository";
import MockConsoleFramePresenter from "./MockConsoleFramePresenter";
describe("ToggleAddonOperator", () => {
describe("#run", () => {
it("toggles addon-enabled state", async () => {
const client = new MockAddonIndicatorClient(true);
const repository = new MockAddonEnabledRepository(true);
const presenter = new MockConsoleFramePresenter(true);
const sut = new ToggleAddonOperator(client, repository, presenter);
await sut.run();
expect(client.enabled).toBeFalsy;
expect(repository.enabled).toBeFalsy;
expect(presenter.attached).toBeFalsy;
await sut.run();
expect(client.enabled).toBeTruthy;
expect(repository.enabled).toBeTruthy;
expect(presenter.attached).toBeTruthy;
});
});
});
|