From 84df6f233677a16f8a3f84b3eb7e77923da2c7fa Mon Sep 17 00:00:00 2001
From: Shin'ya Ueoka <ueokande@i-beam.org>
Date: Sun, 26 Sep 2021 14:15:33 +0900
Subject: Use jest API and fix some tests

---
 test/background/usecases/SettingUseCase.test.ts | 36 ++++++++++++-------------
 1 file changed, 17 insertions(+), 19 deletions(-)

(limited to 'test/background')

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
+        );
       });
     });
   });
-- 
cgit v1.2.3