@@ -36,6 +36,11 @@ const loadNotice = async () => {
3636 return import ( "../../src/client/settings/store/restart-notice" ) ;
3737} ;
3838
39+ const loadFresh = async ( tag : string ) => {
40+ stubWindow ( ) ;
41+ return import ( `../../src/client/settings/store/restart-notice?${ tag } ` ) ;
42+ } ;
43+
3944describe ( "restart notice state check" , ( ) => {
4045 beforeEach ( ( ) => {
4146 calls = [ ] ;
@@ -64,6 +69,26 @@ describe("restart notice state check", () => {
6469 expect ( await pendingReasons ( ( ) => null ) ) . toBeNull ( ) ;
6570 } ) ;
6671
72+ test ( "keeps split reasons distinct from one reason holding a separator" , async ( ) => {
73+ const { pendingReasons } = await loadNotice ( ) ;
74+ stubFetch ( jsonOnce ( { pending : true , reasons : [ 'plugin "a|b" was added' ] } ) ) ;
75+ expect ( await pendingReasons ( ( ) => null ) ) . toEqual ( [ 'plugin "a|b" was added' ] ) ;
76+
77+ stubFetch ( jsonOnce ( { pending : true , reasons : [ 'plugin "a' , 'b" was added' ] } ) ) ;
78+ expect ( await pendingReasons ( ( ) => null ) ) . toEqual ( [
79+ 'plugin "a' ,
80+ 'b" was added' ,
81+ ] ) ;
82+ } ) ;
83+
84+ test ( "still notifies when a pending restart carries no reasons" , async ( ) => {
85+ const { pendingReasons } = await loadFresh ( "empty-reasons" ) ;
86+ stubFetch ( jsonOnce ( { pending : true , reasons : [ ] } ) ) ;
87+
88+ expect ( await pendingReasons ( ( ) => null ) ) . toEqual ( [ ] ) ;
89+ expect ( await pendingReasons ( ( ) => null ) ) . toBeNull ( ) ;
90+ } ) ;
91+
6792 test ( "returns nothing when the restart is not pending" , async ( ) => {
6893 const { pendingReasons } = await loadNotice ( ) ;
6994 stubFetch ( jsonOnce ( { pending : false , reasons : [ 'engine "gamma" was added' ] } ) ) ;
0 commit comments