@@ -2168,4 +2168,67 @@ describe('GSBanner Overage Alerts', function () {
2168
2168
)
2169
2169
) . toBe ( false ) ;
2170
2170
} ) ;
2171
+
2172
+ it ( 'shows see usage button for overages that are not strictly seat-based' , async function ( ) {
2173
+ const organization = OrganizationFixture ( ) ;
2174
+ const subscription = SubscriptionFixture ( {
2175
+ organization,
2176
+ plan : 'am3_team' ,
2177
+ categories : {
2178
+ monitorSeats : MetricHistoryFixture ( { usageExceeded : true } ) ,
2179
+ profileDuration : MetricHistoryFixture ( { usageExceeded : true } ) ,
2180
+ } ,
2181
+ onDemandPeriodStart : '2025-01-01' ,
2182
+ onDemandPeriodEnd : '2025-01-31' ,
2183
+ } ) ;
2184
+ SubscriptionStore . set ( organization . slug , subscription ) ;
2185
+
2186
+ const { router} = render ( < GSBanner organization = { organization } /> , {
2187
+ organization,
2188
+ } ) ;
2189
+
2190
+ expect (
2191
+ await screen . findByTestId ( 'overage-banner-monitorSeat-profileDuration' )
2192
+ ) . toBeInTheDocument ( ) ;
2193
+
2194
+ const seeUsageButton = await screen . findByRole ( 'button' , { name : 'See Usage' } ) ;
2195
+ await userEvent . click ( seeUsageButton ) ;
2196
+
2197
+ expect ( router . location ) . toEqual (
2198
+ expect . objectContaining ( {
2199
+ pathname : `/organizations/${ organization . slug } /stats/` ,
2200
+ query : {
2201
+ dataCategory : 'profileDuration' , // doesn't use monitorSeat because it does not have a stats page
2202
+ pageStart : '2025-01-01' ,
2203
+ pageEnd : '2025-01-31' ,
2204
+ pageUtc : 'true' ,
2205
+ } ,
2206
+ } )
2207
+ ) ;
2208
+ } ) ;
2209
+
2210
+ it ( 'does not show see usage button for overages that are strictly seat-based' , async function ( ) {
2211
+ const organization = OrganizationFixture ( ) ;
2212
+ const subscription = SubscriptionFixture ( {
2213
+ organization,
2214
+ plan : 'am3_team' ,
2215
+ categories : {
2216
+ monitorSeats : MetricHistoryFixture ( { usageExceeded : true } ) ,
2217
+ uptime : MetricHistoryFixture ( { usageExceeded : true } ) ,
2218
+ } ,
2219
+ onDemandPeriodStart : '2025-01-01' ,
2220
+ onDemandPeriodEnd : '2025-01-31' ,
2221
+ } ) ;
2222
+ SubscriptionStore . set ( organization . slug , subscription ) ;
2223
+
2224
+ render ( < GSBanner organization = { organization } /> , {
2225
+ organization,
2226
+ } ) ;
2227
+
2228
+ expect (
2229
+ await screen . findByTestId ( 'overage-banner-monitorSeat-uptime' )
2230
+ ) . toBeInTheDocument ( ) ;
2231
+
2232
+ expect ( screen . queryByRole ( 'button' , { name : 'See Usage' } ) ) . not . toBeInTheDocument ( ) ;
2233
+ } ) ;
2171
2234
} ) ;
0 commit comments