@@ -4,6 +4,7 @@ import { MemoryRouter } from 'react-router-dom';
44
55import { renderWithAppContext } from '../__helpers__/test-utils' ;
66import { mockAccountNotifications } from '../__mocks__/notifications-mocks' ;
7+ import { mockSettings } from '../__mocks__/state-mocks' ;
78import * as comms from '../utils/comms' ;
89import { Sidebar } from './Sidebar' ;
910
@@ -49,14 +50,11 @@ describe('renderer/components/Sidebar.tsx', () => {
4950 expect ( tree ) . toMatchSnapshot ( ) ;
5051 } ) ;
5152
52- it ( 'should navigate home when clicking the gitify logo' , async ( ) => {
53+ it ( 'should navigate home when clicking logo' , async ( ) => {
5354 renderWithAppContext (
5455 < MemoryRouter >
5556 < Sidebar />
5657 </ MemoryRouter > ,
57- {
58- isLoggedIn : false ,
59- } ,
6058 ) ;
6159
6260 await userEvent . click ( screen . getByTestId ( 'sidebar-home' ) ) ;
@@ -71,9 +69,6 @@ describe('renderer/components/Sidebar.tsx', () => {
7169 < MemoryRouter >
7270 < Sidebar />
7371 </ MemoryRouter > ,
74- {
75- isLoggedIn : true ,
76- } ,
7772 ) ;
7873
7974 await userEvent . click ( screen . getByTestId ( 'sidebar-notifications' ) ) ;
@@ -90,7 +85,6 @@ describe('renderer/components/Sidebar.tsx', () => {
9085 < Sidebar />
9186 </ MemoryRouter > ,
9287 {
93- isLoggedIn : true ,
9488 notifications : [ ] ,
9589 } ,
9690 ) ;
@@ -104,7 +98,6 @@ describe('renderer/components/Sidebar.tsx', () => {
10498 < Sidebar />
10599 </ MemoryRouter > ,
106100 {
107- isLoggedIn : true ,
108101 notifications : mockAccountNotifications ,
109102 } ,
110103 ) ;
@@ -119,9 +112,6 @@ describe('renderer/components/Sidebar.tsx', () => {
119112 < MemoryRouter >
120113 < Sidebar />
121114 </ MemoryRouter > ,
122- {
123- isLoggedIn : true ,
124- } ,
125115 ) ;
126116
127117 await userEvent . click ( screen . getByTestId ( 'sidebar-filter-notifications' ) ) ;
@@ -135,16 +125,31 @@ describe('renderer/components/Sidebar.tsx', () => {
135125 < MemoryRouter initialEntries = { [ '/filters' ] } >
136126 < Sidebar />
137127 </ MemoryRouter > ,
138- {
139- isLoggedIn : true ,
140- } ,
141128 ) ;
142129
143130 await userEvent . click ( screen . getByTestId ( 'sidebar-filter-notifications' ) ) ;
144131
145132 expect ( mockNavigate ) . toHaveBeenCalledTimes ( 1 ) ;
146133 expect ( mockNavigate ) . toHaveBeenCalledWith ( '/' , { replace : true } ) ;
147134 } ) ;
135+
136+ it ( 'highlight filters sidebar if any are saved' , ( ) => {
137+ renderWithAppContext (
138+ < MemoryRouter >
139+ < Sidebar />
140+ </ MemoryRouter > ,
141+ {
142+ settings : {
143+ ...mockSettings ,
144+ filterReasons : [ 'assign' ] ,
145+ } ,
146+ } ,
147+ ) ;
148+
149+ expect (
150+ screen . getByTestId ( 'sidebar-filter-notifications' ) ,
151+ ) . toMatchSnapshot ( ) ;
152+ } ) ;
148153 } ) ;
149154
150155 describe ( 'quick links' , ( ) => {
@@ -154,7 +159,6 @@ describe('renderer/components/Sidebar.tsx', () => {
154159 < Sidebar />
155160 </ MemoryRouter > ,
156161 {
157- isLoggedIn : true ,
158162 notifications : mockAccountNotifications ,
159163 } ,
160164 ) ;
@@ -173,7 +177,6 @@ describe('renderer/components/Sidebar.tsx', () => {
173177 < Sidebar />
174178 </ MemoryRouter > ,
175179 {
176- isLoggedIn : true ,
177180 notifications : mockAccountNotifications ,
178181 } ,
179182 ) ;
@@ -194,8 +197,6 @@ describe('renderer/components/Sidebar.tsx', () => {
194197 < Sidebar />
195198 </ MemoryRouter > ,
196199 {
197- isLoggedIn : true ,
198- notifications : [ ] ,
199200 fetchNotifications : mockFetchNotifications ,
200201 status : 'success' ,
201202 } ,
@@ -212,8 +213,6 @@ describe('renderer/components/Sidebar.tsx', () => {
212213 < Sidebar />
213214 </ MemoryRouter > ,
214215 {
215- isLoggedIn : true ,
216- notifications : [ ] ,
217216 fetchNotifications : mockFetchNotifications ,
218217 status : 'loading' ,
219218 } ,
@@ -231,9 +230,6 @@ describe('renderer/components/Sidebar.tsx', () => {
231230 < MemoryRouter >
232231 < Sidebar />
233232 </ MemoryRouter > ,
234- {
235- isLoggedIn : true ,
236- } ,
237233 ) ;
238234
239235 await userEvent . click ( screen . getByTestId ( 'sidebar-settings' ) ) ;
@@ -248,7 +244,6 @@ describe('renderer/components/Sidebar.tsx', () => {
248244 < Sidebar />
249245 </ MemoryRouter > ,
250246 {
251- isLoggedIn : true ,
252247 fetchNotifications : mockFetchNotifications ,
253248 } ,
254249 ) ;
0 commit comments