aboutsummaryrefslogtreecommitdiff
path: root/test/content/repositories/FollowKeyRepository.test.ts
blob: fa35a54fde29a29a3154f1881f852d8e3494a560 (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
import FollowKeyRepository, {
  FollowKeyRepositoryImpl,
} from "../../../src/content/repositories/FollowKeyRepository";

describe("FollowKeyRepositoryImpl", () => {
  let sut: FollowKeyRepository;

  beforeEach(() => {
    sut = new FollowKeyRepositoryImpl();
  });

  describe("#getKeys()/#pushKey()/#popKey()", () => {
    it("enqueues keys", () => {
      expect(sut.getKeys()).toHaveLength(0);

      sut.pushKey("a");
      sut.pushKey("b");
      sut.pushKey("c");
      expect(sut.getKeys()).toEqual(["a", "b", "c"]);

      sut.popKey();
      expect(sut.getKeys()).toEqual(["a", "b"]);

      sut.clearKeys();
      expect(sut.getKeys()).toHaveLength(0);
    });
  });
});