Skip to content

Commit d2402d3

Browse files
setchyafonsojramos
andauthored
feat(settings): enable detailed notifications by default (#1128)
* feat(settings): default detailedNotifications on * fix test --------- Co-authored-by: Afonso Jorge Ramos <[email protected]>
1 parent 92471bf commit d2402d3

File tree

6 files changed

+25
-11
lines changed

6 files changed

+25
-11
lines changed

src/__mocks__/mock-state.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export const mockSettings: SettingsState = {
1515
showNotificationsCountInTray: false,
1616
openAtStartup: false,
1717
theme: Theme.SYSTEM,
18-
detailedNotifications: false,
18+
detailedNotifications: true,
1919
markAsDoneOnOpen: false,
2020
showAccountHostname: false,
2121
delayNotificationState: false,

src/context/App.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ describe('context/App.tsx', () => {
330330
showNotificationsCountInTray: false,
331331
openAtStartup: false,
332332
theme: 'SYSTEM',
333-
detailedNotifications: false,
333+
detailedNotifications: true,
334334
markAsDoneOnOpen: false,
335335
showAccountHostname: false,
336336
delayNotificationState: false,
@@ -375,7 +375,7 @@ describe('context/App.tsx', () => {
375375
showNotificationsCountInTray: false,
376376
openAtStartup: true,
377377
theme: 'SYSTEM',
378-
detailedNotifications: false,
378+
detailedNotifications: true,
379379
markAsDoneOnOpen: false,
380380
showAccountHostname: false,
381381
delayNotificationState: false,

src/context/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export const defaultSettings: SettingsState = {
4141
showNotificationsCountInTray: false,
4242
openAtStartup: false,
4343
theme: Theme.SYSTEM,
44-
detailedNotifications: false,
44+
detailedNotifications: true,
4545
markAsDoneOnOpen: false,
4646
showAccountHostname: false,
4747
delayNotificationState: false,

src/hooks/useNotifications.test.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ describe('hooks/useNotifications.ts', () => {
3434
const { result } = renderHook(() => useNotifications());
3535

3636
act(() => {
37-
result.current.fetchNotifications(mockAccounts, mockSettings);
37+
result.current.fetchNotifications(mockAccounts, {
38+
...mockSettings,
39+
detailedNotifications: false,
40+
});
3841
});
3942

4043
expect(result.current.status).toBe('loading');
@@ -116,7 +119,10 @@ describe('hooks/useNotifications.ts', () => {
116119
const { result } = renderHook(() => useNotifications());
117120

118121
act(() => {
119-
result.current.fetchNotifications(accounts, mockSettings);
122+
result.current.fetchNotifications(accounts, {
123+
...mockSettings,
124+
detailedNotifications: false,
125+
});
120126
});
121127

122128
await waitFor(() => {
@@ -179,7 +185,10 @@ describe('hooks/useNotifications.ts', () => {
179185
const { result } = renderHook(() => useNotifications());
180186

181187
act(() => {
182-
result.current.fetchNotifications(accounts, mockSettings);
188+
result.current.fetchNotifications(accounts, {
189+
...mockSettings,
190+
detailedNotifications: false,
191+
});
183192
});
184193

185194
await waitFor(() => {
@@ -417,7 +426,10 @@ describe('hooks/useNotifications.ts', () => {
417426
const { result } = renderHook(() => useNotifications());
418427

419428
act(() => {
420-
result.current.fetchNotifications(mockAccounts, mockSettings);
429+
result.current.fetchNotifications(mockAccounts, {
430+
...mockSettings,
431+
detailedNotifications: false,
432+
});
421433
});
422434

423435
await waitFor(() => {

src/routes/Settings.test.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,10 @@ describe('routes/Settings.tsx', () => {
113113
fireEvent.click(screen.getByLabelText('Detailed notifications'));
114114

115115
expect(updateSetting).toHaveBeenCalledTimes(1);
116-
expect(updateSetting).toHaveBeenCalledWith('detailedNotifications', true);
116+
expect(updateSetting).toHaveBeenCalledWith(
117+
'detailedNotifications',
118+
false,
119+
);
117120
});
118121
});
119122

src/routes/__snapshots__/Settings.test.tsx.snap

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)