aboutsummaryrefslogtreecommitdiff
path: root/test/background/operators/impls/FindOperatorFactoryChain.ts
blob: 0fd234fede82353db7ccf1f14a630303cbe58156 (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
import "reflect-metadata";
import { expect } from "chai";
import TabOperatorFactoryChain from "../../../../src/background/operators/impls/TabOperatorFactoryChain";
import MockTabPresenter from "../../mock/MockTabPresenter";
import * as operations from "../../../../src/shared/operations";
import FindNextOperator from "../../../../src/background/operators/impls/FindNextOperator";
import FindPrevOperator from "../../../../src/background/operators/impls/FindPrevOperator";

describe("FindOperatorFactoryChain", () => {
  describe("#create", () => {
    it("returns a operator for the operation", async () => {
      const tabPresenter = new MockTabPresenter();
      const sut = new TabOperatorFactoryChain(tabPresenter);

      expect(sut.create({ type: operations.FIND_NEXT })).to.be.instanceOf(
        FindNextOperator
      );
      expect(sut.create({ type: operations.FIND_PREV })).to.be.instanceOf(
        FindPrevOperator
      );
    });
  });
});