aboutsummaryrefslogtreecommitdiff
path: root/test/background
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2021-09-26 14:15:33 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2021-09-26 16:12:58 +0900
commit84df6f233677a16f8a3f84b3eb7e77923da2c7fa (patch)
treefd397824d5295d4e38a6412d3faa1f06214a839b /test/background
parente1b4a2dc6763966628bc4a29838c48022cd5b4e5 (diff)
Use jest API and fix some tests
Diffstat (limited to 'test/background')
-rw-r--r--test/background/usecases/SettingUseCase.test.ts36
1 files changed, 17 insertions, 19 deletions
diff --git a/test/background/usecases/SettingUseCase.test.ts b/test/background/usecases/SettingUseCase.test.ts
index 8a4c2b2..54b6711 100644
--- a/test/background/usecases/SettingUseCase.test.ts
+++ b/test/background/usecases/SettingUseCase.test.ts
@@ -87,7 +87,7 @@ describe("SettingUseCase", () => {
});
describe("reload", () => {
- context("when sync is not set", () => {
+ describe("when sync is not set", () => {
it("loads settings from local storage", async () => {
const settings = new Settings({
keymaps: DefaultSetting.keymaps,
@@ -116,7 +116,7 @@ describe("SettingUseCase", () => {
});
});
- context("when local is not set", () => {
+ describe("when local is not set", () => {
it("loads settings from sync storage", async () => {
const settings = new Settings({
keymaps: DefaultSetting.keymaps,
@@ -145,23 +145,21 @@ describe("SettingUseCase", () => {
});
});
- context("neither local nor sync not set", () => {
- it("loads default settings", async () => {
- it("loads settings from sync storage", async () => {
- sinon
- .stub(syncSettingRepository, "load")
- .returns(Promise.resolve(null));
- sinon
- .stub(localSettingRepository, "load")
- .returns(Promise.resolve(null));
-
- await sut.reload();
-
- const current = await cachedSettingRepository.get();
- expect(current.properties.hintchars).to.equal(
- DefaultSetting.properties.hintchars
- );
- });
+ describe("neither local nor sync not set", () => {
+ it("loads settings from sync storage", async () => {
+ sinon
+ .stub(syncSettingRepository, "load")
+ .returns(Promise.resolve(null));
+ sinon
+ .stub(localSettingRepository, "load")
+ .returns(Promise.resolve(null));
+
+ await sut.reload();
+
+ const current = await cachedSettingRepository.get();
+ expect(current.properties.hintchars).to.equal(
+ DefaultSetting.properties.hintchars
+ );
});
});
});