From fa88c8747ed48f0aeaa042634a2f3f99bc82f205 Mon Sep 17 00:00:00 2001
From: Guilhem CARRON <gcarron@grandlyon.com>
Date: Mon, 20 Sep 2021 12:35:56 +0000
Subject: [PATCH] fix: Change default value for monthly analysis notification
 to true.

---
 cozy-doctypes                                 |  1 +
 src/components/Options/ReportOptions.spec.tsx | 14 +++++++-------
 src/db/profileData.json                       |  2 +-
 src/store/profile/profile.reducer.ts          |  2 +-
 tests/__mocks__/store.ts                      |  2 +-
 5 files changed, 11 insertions(+), 10 deletions(-)
 create mode 160000 cozy-doctypes

diff --git a/cozy-doctypes b/cozy-doctypes
new file mode 160000
index 000000000..f4d6559b8
--- /dev/null
+++ b/cozy-doctypes
@@ -0,0 +1 @@
+Subproject commit f4d6559b8c0a764136f73271eb814187410ceebc
diff --git a/src/components/Options/ReportOptions.spec.tsx b/src/components/Options/ReportOptions.spec.tsx
index 65778d611..8636d80be 100644
--- a/src/components/Options/ReportOptions.spec.tsx
+++ b/src/components/Options/ReportOptions.spec.tsx
@@ -38,16 +38,16 @@ describe('ReportOptions component', () => {
     updateProfileSpy.mockClear()
   })
 
-  it('should be rendered with sendAnalysisNotification to false', () => {
+  it('should be rendered with sendAnalysisNotification to true', () => {
     const wrapper = mount(
       <Provider store={store}>
         <ReportOptions />
       </Provider>
     )
-    expect(wrapper.find(Button).text()).toBe('profile.report.activate')
+    expect(wrapper.find(Button).text()).toBe('profile.report.deactivate')
   })
 
-  it('should update the profile with sendAnalysisNotification to true', () => {
+  it('should update the profile with sendAnalysisNotification to false', () => {
     const wrapper = mount(
       <Provider store={store}>
         <ReportOptions />
@@ -59,11 +59,11 @@ describe('ReportOptions component', () => {
       .simulate('click')
     expect(updateProfileSpy).toBeCalledTimes(1)
     expect(updateProfileSpy).toHaveBeenCalledWith({
-      sendAnalysisNotification: true,
+      sendAnalysisNotification: false,
     })
   })
-  it('should be rendered with sendAnalysisNotification true and toggle it to false', () => {
-    mockInitialEcolyoState.profile.sendAnalysisNotification = true
+  it('should be rendered with sendAnalysisNotification false and toggle it to true', () => {
+    mockInitialEcolyoState.profile.sendAnalysisNotification = false
     store = createMockStore(mockInitialEcolyoState)
 
     const wrapper = mount(
@@ -77,7 +77,7 @@ describe('ReportOptions component', () => {
       .simulate('click')
     expect(updateProfileSpy).toBeCalledTimes(1)
     expect(updateProfileSpy).toHaveBeenCalledWith({
-      sendAnalysisNotification: false,
+      sendAnalysisNotification: true,
     })
   })
 })
diff --git a/src/db/profileData.json b/src/db/profileData.json
index 991a1bfb4..94d627979 100644
--- a/src/db/profileData.json
+++ b/src/db/profileData.json
@@ -9,7 +9,7 @@
     "lastConnectionDate": "0000-01-01T00:00:00.000Z",
     "haveSeenOldFluidModal": false,
     "haveSeenLastAnalysis": true,
-    "sendAnalysisNotification": false,
+    "sendAnalysisNotification": true,
     "monthlyAnalysisDate": "0000-01-01T00:00:00.000Z",
     "isLastTermAccepted": false,
     "isProfileTypeCompleted": false,
diff --git a/src/store/profile/profile.reducer.ts b/src/store/profile/profile.reducer.ts
index 4033835e9..df049b075 100644
--- a/src/store/profile/profile.reducer.ts
+++ b/src/store/profile/profile.reducer.ts
@@ -17,7 +17,7 @@ const initialState: Profile = {
   lastConnectionDate: DateTime.fromISO('0000-01-01T00:00:00.000Z'),
   haveSeenOldFluidModal: true,
   haveSeenLastAnalysis: true,
-  sendAnalysisNotification: false,
+  sendAnalysisNotification: true,
   mailToken: '',
   monthlyAnalysisDate: DateTime.fromISO('0000-01-01T00:00:00.000Z'),
   isProfileTypeCompleted: false,
diff --git a/tests/__mocks__/store.ts b/tests/__mocks__/store.ts
index c7e30e6d7..fa8a9e56d 100644
--- a/tests/__mocks__/store.ts
+++ b/tests/__mocks__/store.ts
@@ -108,7 +108,7 @@ export const mockInitialProfileState: Profile = {
   lastConnectionDate: DateTime.fromISO('0000-01-01T00:00:00.000Z'),
   haveSeenOldFluidModal: true,
   haveSeenLastAnalysis: true,
-  sendAnalysisNotification: false,
+  sendAnalysisNotification: true,
   mailToken: '',
   monthlyAnalysisDate: DateTime.fromISO('0000-01-01T00:00:00.000Z'),
   isProfileTypeCompleted: false,
-- 
GitLab