aboutsummaryrefslogtreecommitdiff
path: root/test/background/usecases
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2021-09-26 17:01:31 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2021-09-26 17:23:14 +0900
commite304581fb15eabb3a973d363a282ee7546561e01 (patch)
tree1afb21a2dee2ada3d10c1417fa61c0aae1f83077 /test/background/usecases
parent11d6d725eee2ac0a1c16e4c7a4ce4f296bb6b016 (diff)
Do not use chai on unit test
Diffstat (limited to 'test/background/usecases')
-rw-r--r--test/background/usecases/SettingUseCase.test.ts9
-rw-r--r--test/background/usecases/parsers.test.ts30
2 files changed, 16 insertions, 23 deletions
diff --git a/test/background/usecases/SettingUseCase.test.ts b/test/background/usecases/SettingUseCase.test.ts
index 54b6711..af2fb1e 100644
--- a/test/background/usecases/SettingUseCase.test.ts
+++ b/test/background/usecases/SettingUseCase.test.ts
@@ -7,7 +7,6 @@ import Settings, {
DefaultSetting,
} from "../../../src/shared/settings/Settings";
import Notifier from "../../../src/background/presenters/Notifier";
-import { expect } from "chai";
import Properties from "../../../src/shared/settings/Properties";
import sinon from "sinon";
@@ -82,7 +81,7 @@ describe("SettingUseCase", () => {
.returns(Promise.resolve(settings));
const got = await sut.getCached();
- expect(got.properties.hintchars).to.equal("abcd1234");
+ expect(got.properties.hintchars).toEqual("abcd1234");
});
});
@@ -112,7 +111,7 @@ describe("SettingUseCase", () => {
await sut.reload();
const current = await cachedSettingRepository.get();
- expect(current.properties.hintchars).to.equal("abcd1234");
+ expect(current.properties.hintchars).toEqual("abcd1234");
});
});
@@ -141,7 +140,7 @@ describe("SettingUseCase", () => {
await sut.reload();
const current = await cachedSettingRepository.get();
- expect(current.properties.hintchars).to.equal("aaaa1111");
+ expect(current.properties.hintchars).toEqual("aaaa1111");
});
});
@@ -157,7 +156,7 @@ describe("SettingUseCase", () => {
await sut.reload();
const current = await cachedSettingRepository.get();
- expect(current.properties.hintchars).to.equal(
+ expect(current.properties.hintchars).toEqual(
DefaultSetting.properties.hintchars
);
});
diff --git a/test/background/usecases/parsers.test.ts b/test/background/usecases/parsers.test.ts
index 019b56e..db26b7a 100644
--- a/test/background/usecases/parsers.test.ts
+++ b/test/background/usecases/parsers.test.ts
@@ -1,42 +1,36 @@
import * as parsers from "../../../src/background/usecases/parsers";
-import { expect } from "chai";
describe("shared/commands/parsers", () => {
describe("#parsers.parseSetOption", () => {
it("parse set string", () => {
const [key, value] = parsers.parseSetOption("hintchars=abcdefgh");
- expect(key).to.equal("hintchars");
- expect(value).to.equal("abcdefgh");
+ expect(key).toEqual("hintchars");
+ expect(value).toEqual("abcdefgh");
});
it("parse set empty string", () => {
const [key, value] = parsers.parseSetOption("hintchars=");
- expect(key).to.equal("hintchars");
- expect(value).to.equal("");
+ expect(key).toEqual("hintchars");
+ expect(value).toEqual("");
});
it("parse set boolean", () => {
let [key, value] = parsers.parseSetOption("smoothscroll");
- expect(key).to.equal("smoothscroll");
- expect(value).to.be.true;
+ expect(key).toEqual("smoothscroll");
+ expect(value).toBeTruthy;
[key, value] = parsers.parseSetOption("nosmoothscroll");
- expect(key).to.equal("smoothscroll");
- expect(value).to.be.false;
+ expect(key).toEqual("smoothscroll");
+ expect(value).toBeFalsy;
});
it("throws error on unknown property", () => {
- expect(() => parsers.parseSetOption("encoding=utf-8")).to.throw(
- Error,
+ expect(() => parsers.parseSetOption("encoding=utf-8")).toThrowError(
"Unknown"
);
- expect(() => parsers.parseSetOption("paste")).to.throw(Error, "Unknown");
- expect(() => parsers.parseSetOption("nopaste")).to.throw(
- Error,
- "Unknown"
- );
- expect(() => parsers.parseSetOption("smoothscroll=yes")).to.throw(
- Error,
+ expect(() => parsers.parseSetOption("paste")).toThrowError("Unknown");
+ expect(() => parsers.parseSetOption("nopaste")).toThrowError("Unknown");
+ expect(() => parsers.parseSetOption("smoothscroll=yes")).toThrowError(
"Invalid argument"
);
});