File tree 4 files changed +48
-9
lines changed
4 files changed +48
-9
lines changed Original file line number Diff line number Diff line change @@ -28,8 +28,11 @@ export type IssueStateType =
28
28
| 'completed'
29
29
| 'reopened'
30
30
| 'not_planned' ;
31
+
31
32
export type PullRequestStateType = 'closed' | 'open' | 'merged' | 'draft' ;
33
+
32
34
export type StateType = IssueStateType | PullRequestStateType ;
35
+
33
36
export type ViewerSubscription = 'IGNORED' | 'SUBSCRIBED' | 'UNSUBSCRIBED' ;
34
37
35
38
export interface Notification {
Original file line number Diff line number Diff line change 1
1
// Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
3
+ exports [` ./utils/github-api.ts should format the notification color 1` ] = ` "text-red-500"` ;
4
+
5
+ exports [` ./utils/github-api.ts should format the notification color 2` ] = ` "text-purple-500"` ;
6
+
7
+ exports [` ./utils/github-api.ts should format the notification color 3` ] = ` "text-gray-600"` ;
8
+
9
+ exports [` ./utils/github-api.ts should format the notification color 4` ] = ` "text-purple-500"` ;
10
+
11
+ exports [` ./utils/github-api.ts should format the notification color 5` ] = ` "text-gray-300"` ;
12
+
13
+ exports [` ./utils/github-api.ts should format the notification color 6` ] = ` "text-green-500"` ;
14
+
15
+ exports [` ./utils/github-api.ts should format the notification color 7` ] = ` "text-green-500"` ;
16
+
17
+ exports [` ./utils/github-api.ts should format the notification color 8` ] = `
18
+ {
19
+ " description" : " The reason for this notification is not supported by the app." ,
20
+ " type" : " Unknown" ,
21
+ }
22
+ ` ;
23
+
3
24
exports [` ./utils/github-api.ts should format the notification reason 1` ] = `
4
25
{
5
26
" description" : " You were assigned to the issue." ,
Original file line number Diff line number Diff line change 1
- import { formatReason , getNotificationTypeIcon } from './github-api' ;
1
+ import {
2
+ formatReason ,
3
+ getNotificationTypeIcon ,
4
+ getNotificationTypeIconColor ,
5
+ } from './github-api' ;
2
6
import { Reason , SubjectType } from '../typesGithub' ;
3
7
4
8
describe ( './utils/github-api.ts' , ( ) => {
@@ -62,4 +66,15 @@ describe('./utils/github-api.ts', () => {
62
66
'QuestionIcon' ,
63
67
) ;
64
68
} ) ;
69
+
70
+ it ( 'should format the notification color' , ( ) => {
71
+ expect ( getNotificationTypeIconColor ( 'closed' ) ) . toMatchSnapshot ( ) ;
72
+ expect ( getNotificationTypeIconColor ( 'completed' ) ) . toMatchSnapshot ( ) ;
73
+ expect ( getNotificationTypeIconColor ( 'draft' ) ) . toMatchSnapshot ( ) ;
74
+ expect ( getNotificationTypeIconColor ( 'merged' ) ) . toMatchSnapshot ( ) ;
75
+ expect ( getNotificationTypeIconColor ( 'not_planned' ) ) . toMatchSnapshot ( ) ;
76
+ expect ( getNotificationTypeIconColor ( 'open' ) ) . toMatchSnapshot ( ) ;
77
+ expect ( getNotificationTypeIconColor ( 'reopened' ) ) . toMatchSnapshot ( ) ;
78
+ expect ( formatReason ( 'something_else_unknown' as Reason ) ) . toMatchSnapshot ( ) ;
79
+ } ) ;
65
80
} ) ;
Original file line number Diff line number Diff line change @@ -119,18 +119,18 @@ export function getNotificationTypeIconColor(state: StateType): string {
119
119
switch ( state ) {
120
120
case 'closed' :
121
121
return 'text-red-500' ;
122
- case 'open' :
123
- return 'text-green-500' ;
124
- case 'merged' :
125
- return 'text-purple-500' ;
126
- case 'reopened' :
127
- return 'text-green-500' ;
128
- case 'not_planned' :
129
- return 'text-gray-300' ;
130
122
case 'completed' :
131
123
return 'text-purple-500' ;
132
124
case 'draft' :
133
125
return 'text-gray-600' ;
126
+ case 'merged' :
127
+ return 'text-purple-500' ;
128
+ case 'not_planned' :
129
+ return 'text-gray-300' ;
130
+ case 'open' :
131
+ return 'text-green-500' ;
132
+ case 'reopened' :
133
+ return 'text-green-500' ;
134
134
default :
135
135
return 'text-gray-300' ;
136
136
}
You can’t perform that action at this time.
0 commit comments