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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
import FollowMasterRepository, {
FollowMasterRepositoryImpl,
} from "../../../src/content/repositories/FollowMasterRepository";
describe("FollowMasterRepositoryImpl", () => {
let sut: FollowMasterRepository;
beforeEach(() => {
sut = new FollowMasterRepositoryImpl();
});
describe("#getTags()/#addTag()/#clearTags()", () => {
it("gets, adds and clears tags", () => {
expect(sut.getTags()).toHaveLength(0);
sut.addTag("a");
sut.addTag("b");
sut.addTag("c");
expect(sut.getTags()).toEqual(["a", "b", "c"]);
sut.clearTags();
expect(sut.getTags()).toHaveLength(0);
});
});
describe("#getTagsByPrefix", () => {
it("gets tags matched by prefix", () => {
for (const tag of ["a", "aa", "ab", "b", "ba", "bb"]) {
sut.addTag(tag);
}
expect(sut.getTagsByPrefix("a")).toEqual(["a", "aa", "ab"]);
expect(sut.getTagsByPrefix("aa")).toEqual(["aa"]);
expect(sut.getTagsByPrefix("b")).toEqual(["b", "ba", "bb"]);
expect(sut.getTagsByPrefix("c")).toHaveLength(0);
});
});
describe("#setCurrentFollowMode()/#getCurrentNewTabMode()/#getCurrentBackgroundMode", () => {
it("updates and gets follow mode", () => {
sut.setCurrentFollowMode(false, true);
expect(sut.getCurrentNewTabMode()).toBeFalsy;
expect(sut.getCurrentBackgroundMode()).toBeTruthy;
sut.setCurrentFollowMode(true, false);
expect(sut.getCurrentNewTabMode()).toBeTruthy;
expect(sut.getCurrentBackgroundMode()).toBeFalsy;
});
});
});
|