@@ -54,4 +54,78 @@ describe('renderer/utils/notifications/handlers/default.ts', () => {
5454 expect ( defaultHandler . iconColor ( subject ) ) . toBe ( expected ) ;
5555 } ) ;
5656 } ) ;
57+
58+ describe ( 'formattedNotificationType' , ( ) => {
59+ it ( 'formats state and type with proper casing and spacing' , ( ) => {
60+ const notification = partialMockNotification ( {
61+ title : 'Sample' ,
62+ type : 'PullRequest' ,
63+ state : 'open' ,
64+ } ) ;
65+
66+ expect ( defaultHandler . formattedNotificationType ( notification ) ) . toBe (
67+ 'Open Pull Request' ,
68+ ) ;
69+ } ) ;
70+
71+ it ( 'handles missing state (null) gracefully' , ( ) => {
72+ const notification = partialMockNotification ( {
73+ title : 'Sample' ,
74+ type : 'Issue' ,
75+ state : null ,
76+ } ) ;
77+
78+ expect ( defaultHandler . formattedNotificationType ( notification ) ) . toBe (
79+ 'Issue' ,
80+ ) ;
81+ } ) ;
82+ } ) ;
83+
84+ describe ( 'formattedNotificationNumber' , ( ) => {
85+ it ( 'returns formatted number when present' , ( ) => {
86+ const notification = partialMockNotification ( {
87+ title : 'Sample' ,
88+ type : 'Issue' ,
89+ state : 'open' ,
90+ } ) ;
91+ notification . subject . number = 42 ;
92+ expect ( defaultHandler . formattedNotificationNumber ( notification ) ) . toBe (
93+ '#42' ,
94+ ) ;
95+ } ) ;
96+
97+ it ( 'returns empty string when number absent' , ( ) => {
98+ const notification = partialMockNotification ( {
99+ title : 'Sample' ,
100+ type : 'Issue' ,
101+ state : 'open' ,
102+ } ) ;
103+ expect ( defaultHandler . formattedNotificationNumber ( notification ) ) . toBe ( '' ) ;
104+ } ) ;
105+ } ) ;
106+
107+ describe ( 'formattedNotificationTitle' , ( ) => {
108+ it ( 'appends number in brackets when present' , ( ) => {
109+ const notification = partialMockNotification ( {
110+ title : 'Fix bug' ,
111+ type : 'Issue' ,
112+ state : 'open' ,
113+ } ) ;
114+ notification . subject . number = 101 ;
115+ expect ( defaultHandler . formattedNotificationTitle ( notification ) ) . toBe (
116+ 'Fix bug [#101]' ,
117+ ) ;
118+ } ) ;
119+
120+ it ( 'returns title unchanged when number missing' , ( ) => {
121+ const notification = partialMockNotification ( {
122+ title : 'Improve docs' ,
123+ type : 'Issue' ,
124+ state : 'open' ,
125+ } ) ;
126+ expect ( defaultHandler . formattedNotificationTitle ( notification ) ) . toBe (
127+ 'Improve docs' ,
128+ ) ;
129+ } ) ;
130+ } ) ;
57131} ) ;
0 commit comments