File tree Expand file tree Collapse file tree
packages/cli/src/ui/hooks Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -77,10 +77,24 @@ describe('useBanner', () => {
7777 . update ( defaultBannerData . defaultText )
7878 . digest ( 'hex' ) ] : 5 ,
7979 } ) ;
80+ } ) ;
81+
82+ it ( 'should not hide banner if show count exceeds max limit (Legacy format) if it contains an Antigravity announcement' , async ( ) => {
83+ const antigravityBannerData = {
84+ defaultText : 'Antigravity is coming to town!' ,
85+ warningText : '' ,
86+ } ;
87+
88+ mockedPersistentStateGet . mockReturnValue ( {
89+ [ crypto
90+ . createHash ( 'sha256' )
91+ . update ( antigravityBannerData . defaultText )
92+ . digest ( 'hex' ) ] : 5 ,
93+ } ) ;
8094
81- const { result } = await renderHook ( ( ) => useBanner ( defaultBannerData ) ) ;
95+ const { result } = await renderHook ( ( ) => useBanner ( antigravityBannerData ) ) ;
8296
83- expect ( result . current . bannerText ) . toBe ( '' ) ;
97+ expect ( result . current . bannerText ) . toBe ( 'Antigravity is coming to town! ' ) ;
8498 } ) ;
8599
86100 it ( 'should increment the persistent count when banner is shown' , async ( ) => {
Original file line number Diff line number Diff line change @@ -41,7 +41,9 @@ export function useBanner(bannerData: BannerData) {
4141 const currentBannerCount = bannerCounts [ hashedText ] || 0 ;
4242
4343 const showBanner =
44- activeText !== '' && currentBannerCount < DEFAULT_MAX_BANNER_SHOWN_COUNT ;
44+ activeText !== '' &&
45+ ( currentBannerCount < DEFAULT_MAX_BANNER_SHOWN_COUNT ||
46+ activeText . includes ( 'Antigravity' ) ) ;
4547
4648 const rawBannerText = showBanner ? activeText : '' ;
4749 const bannerText = rawBannerText . replace ( / \\ n / g, '\n' ) ;
You can’t perform that action at this time.
0 commit comments