blob: ec5e000fb91cd2917460b9592407a50f734d67f5 (
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
|
import "reflect-metadata";
import RepeatOperatorFactoryChain from "../../../../src/background/operators/impls/RepeatOperatorFactoryChain";
import RepeatLastOperator from "../../../../src/background/operators/impls/RepeatLastOperator";
import OperatorFactory from "../../../../src/background/operators/OperatorFactory";
import MockRepeatRepository from "../../mock/MockRepeatRepository";
import Operator from "../../../../src/content/operators/Operator";
import * as operations from "../../../../src/shared/operations";
class MockOperatorFactory implements OperatorFactory {
create(_op: operations.Operation): Operator {
throw new Error("not implemented");
}
}
describe("RepeatOperatorFactoryChain", () => {
describe("#create", () => {
it("returns a operator for the operation", async () => {
const repeatRepository = new MockRepeatRepository();
const operatorFactory = new MockOperatorFactory();
const sut = new RepeatOperatorFactoryChain(
repeatRepository,
operatorFactory
);
expect(sut.create({ type: operations.REPEAT_LAST })).toBeInstanceOf(
RepeatLastOperator
);
expect(sut.create({ type: operations.CANCEL })).toBeNull;
});
});
});
|