File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed
Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,26 @@ it('지정된 시간이 된 경우 알림이 새롭게 생성되어 추가된다
3434 waitFor ( ( ) => expect ( result . current . notifications . length ) . toBe ( 1 ) ) ;
3535} ) ;
3636
37- it ( 'index를 기준으로 알림을 적절하게 제거할 수 있다' , ( ) => { } ) ;
37+ it ( 'index를 기준으로 알림을 적절하게 제거할 수 있다' , async ( ) => {
38+ const { result } = renderHook ( ( ) => useNotifications ( events as Event [ ] ) ) ;
39+
40+ const start = new Date ( `${ events [ 0 ] . date } T${ events [ 0 ] . startTime } ` ) ;
41+ const beforeStart = start . getTime ( ) - 10 * 60000 ;
42+
43+ await act ( async ( ) => {
44+ vi . setSystemTime ( new Date ( beforeStart - 1000 ) ) ;
45+ vi . advanceTimersByTime ( 1000 ) ;
46+ } ) ;
47+
48+ waitFor ( ( ) => expect ( result . current . notifications . length ) . toBe ( 1 ) ) ;
49+
50+ const removedIndex = 0 ;
51+
52+ await act ( async ( ) => {
53+ result . current . removeNotification ( removedIndex ) ;
54+ } ) ;
55+
56+ waitFor ( ( ) => expect ( result . current . notifications . length ) . toBe ( 0 ) ) ;
57+ } ) ;
3858
3959it ( '이미 알림이 발생한 이벤트에 대해서는 중복 알림이 발생하지 않아야 한다' , ( ) => { } ) ;
You can’t perform that action at this time.
0 commit comments