File tree Expand file tree Collapse file tree 4 files changed +48
-9
lines changed Expand file tree Collapse file tree 4 files changed +48
-9
lines changed Original file line number Diff line number Diff line change @@ -28,8 +28,11 @@ export type IssueStateType =
2828 | 'completed'
2929 | 'reopened'
3030 | 'not_planned' ;
31+
3132export type PullRequestStateType = 'closed' | 'open' | 'merged' | 'draft' ;
33+
3234export type StateType = IssueStateType | PullRequestStateType ;
35+
3336export type ViewerSubscription = 'IGNORED' | 'SUBSCRIBED' | 'UNSUBSCRIBED' ;
3437
3538export interface Notification {
Original file line number Diff line number Diff line change 11// Jest Snapshot v1, https://goo.gl/fbAQLP
22
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+
324exports [` ./utils/github-api.ts should format the notification reason 1` ] = `
425{
526 " 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' ;
26import { Reason , SubjectType } from '../typesGithub' ;
37
48describe ( './utils/github-api.ts' , ( ) => {
@@ -62,4 +66,15 @@ describe('./utils/github-api.ts', () => {
6266 'QuestionIcon' ,
6367 ) ;
6468 } ) ;
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+ } ) ;
6580} ) ;
Original file line number Diff line number Diff line change @@ -119,18 +119,18 @@ export function getNotificationTypeIconColor(state: StateType): string {
119119 switch ( state ) {
120120 case 'closed' :
121121 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' ;
130122 case 'completed' :
131123 return 'text-purple-500' ;
132124 case 'draft' :
133125 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' ;
134134 default :
135135 return 'text-gray-300' ;
136136 }
You can’t perform that action at this time.
0 commit comments