From 7a56e7fc719d3b0706a64b310c3fbda8eb8a7a3d Mon Sep 17 00:00:00 2001 From: benguedj <71835422+benguedj@users.noreply.github.com> Date: Wed, 14 Sep 2022 16:43:35 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20Les=20'Toogles'=20sont=20?= =?UTF-8?q?activ=C3=A9s=20par=20d=C3=A9faut=20(notifs)=20(#1440)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 🐛 Les 'Toogles' sont activés par défaut (notifs) ✅ Closes: #1439 * fix: 🐛 Corrige un test en erreur * refactor: 💡 PR Les 'Toogles' sont activés par défaut (notifs) --- front/src/utils/notifications/notificationToggle.util.test.ts | 4 ++-- front/src/utils/notifications/notificationToggle.util.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/front/src/utils/notifications/notificationToggle.util.test.ts b/front/src/utils/notifications/notificationToggle.util.test.ts index d5a2e8fda..83c5fc2bd 100644 --- a/front/src/utils/notifications/notificationToggle.util.test.ts +++ b/front/src/utils/notifications/notificationToggle.util.test.ts @@ -36,10 +36,10 @@ describe("Notification Toggle Utils", () => { ); }); - it("should return false when key for type is undefined", async () => { + it("should return true when key for type is undefined (toogle default value)", async () => { await NotificationToggleUtils.isToggleOn(NotificationType.epds).then( (data) => { - expect(data).toEqual(false); + expect(data).toEqual(true); } ); }); diff --git a/front/src/utils/notifications/notificationToggle.util.ts b/front/src/utils/notifications/notificationToggle.util.ts index a9832569f..0a1b3e959 100644 --- a/front/src/utils/notifications/notificationToggle.util.ts +++ b/front/src/utils/notifications/notificationToggle.util.ts @@ -9,7 +9,7 @@ import { getObjectValue } from "../storage.util"; export const isToggleOn = async (type: NotificationType): Promise => { const key = getStorageKey(type); if (key) return (await getObjectValue(key)) as boolean; - return false; + return true; // 'On' par défaut }; export const getStorageKey = (