@@ -2,6 +2,7 @@ import {OrganizationFixture} from 'sentry-fixture/organization';
2
2
3
3
import { MetricHistoryFixture } from 'getsentry-test/fixtures/metricHistory' ;
4
4
import { PlanDetailsLookupFixture } from 'getsentry-test/fixtures/planDetailsLookup' ;
5
+ import { SeerReservedBudgetFixture } from 'getsentry-test/fixtures/reservedBudget' ;
5
6
import {
6
7
Am3DsEnterpriseSubscriptionFixture ,
7
8
SubscriptionFixture ,
@@ -482,6 +483,32 @@ describe('Subscription > PendingChanges', function () {
482
483
expect ( screen . getByText ( 'Feb 1, 2021' ) ) . toBeInTheDocument ( ) ;
483
484
} ) ;
484
485
486
+ it ( 'does not render reserved budget changes' , function ( ) {
487
+ const sub = SubscriptionFixture ( {
488
+ organization,
489
+ plan : 'am3_business' ,
490
+ reservedBudgets : [ SeerReservedBudgetFixture ( { } ) ] ,
491
+ pendingChanges : PendingChangesFixture ( {
492
+ planDetails : PlanDetailsLookupFixture ( 'am3_business' ) ,
493
+ plan : 'am3_business' ,
494
+ planName : 'Business' ,
495
+ reserved : {
496
+ errors : 100_000 ,
497
+ } ,
498
+ } ) ,
499
+ } ) ;
500
+ sub . categories = {
501
+ ...sub . categories ,
502
+ seerAutofix : MetricHistoryFixture ( { ...sub . categories . seerAutofix , reserved : 0 } ) ,
503
+ seerScanner : MetricHistoryFixture ( { ...sub . categories . seerScanner , reserved : 0 } ) ,
504
+ } ;
505
+
506
+ render ( < PendingChanges organization = { organization } subscription = { sub } /> ) ;
507
+ expect ( screen . getByText ( 'Reserved errors change to 100,000' ) ) . toBeInTheDocument ( ) ;
508
+ expect ( screen . queryByText ( / p r o d u c t a c c e s s / ) ) . not . toBeInTheDocument ( ) ;
509
+ expect ( screen . queryByText ( / b u d g e t c h a n g e / ) ) . not . toBeInTheDocument ( ) ;
510
+ } ) ;
511
+
485
512
it ( 'renders reserved budgets with existing budgets without dynamic sampling' , function ( ) {
486
513
const sub = Am3DsEnterpriseSubscriptionFixture ( {
487
514
organization,
@@ -511,7 +538,10 @@ describe('Subscription > PendingChanges', function () {
511
538
expect ( screen . queryByText ( 'accepted spans' ) ) . not . toBeInTheDocument ( ) ;
512
539
expect ( screen . queryByText ( 'stored spans' ) ) . not . toBeInTheDocument ( ) ;
513
540
expect ( screen . queryByText ( 'cost-per-event' ) ) . not . toBeInTheDocument ( ) ;
514
- expect ( screen . getByText ( 'Spans Budget updated to $50,000' ) ) . toBeInTheDocument ( ) ;
541
+ expect (
542
+ screen . getByText ( 'Spans budget change from $100,000 to $50,000' )
543
+ ) . toBeInTheDocument ( ) ;
544
+ expect ( screen . queryByText ( / R e s e r v e d s p a n s / ) ) . not . toBeInTheDocument ( ) ;
515
545
} ) ;
516
546
517
547
it ( 'renders reserved budgets with existing budgets and dynamic sampling' , function ( ) {
@@ -542,7 +572,46 @@ describe('Subscription > PendingChanges', function () {
542
572
render ( < PendingChanges organization = { organization } subscription = { sub } /> ) ;
543
573
544
574
expect ( screen . queryByText ( 'cost-per-event' ) ) . not . toBeInTheDocument ( ) ;
545
- expect ( screen . getByText ( 'Spans Budget updated to $50,000' ) ) . toBeInTheDocument ( ) ;
575
+ expect (
576
+ screen . getByText ( 'Spans budget change from $100,000 to $50,000' )
577
+ ) . toBeInTheDocument ( ) ;
578
+ expect ( screen . queryByText ( / R e s e r v e d s p a n s / ) ) . not . toBeInTheDocument ( ) ;
579
+ } ) ;
580
+
581
+ it ( 'renders fixed budget changes' , function ( ) {
582
+ const sub = SubscriptionFixture ( {
583
+ organization,
584
+ plan : 'am3_team' ,
585
+ hasReservedBudgets : true ,
586
+ reservedBudgets : [ SeerReservedBudgetFixture ( { } ) ] ,
587
+ pendingChanges : PendingChangesFixture ( {
588
+ planDetails : PlanDetailsLookupFixture ( 'am3_team' ) ,
589
+ plan : 'am3_team' ,
590
+ planName : 'Team' ,
591
+ reserved : {
592
+ seerAutofix : 0 ,
593
+ seerScanner : 0 ,
594
+ } ,
595
+ } ) ,
596
+ } ) ;
597
+ sub . categories = {
598
+ ...sub . categories ,
599
+ seerAutofix : MetricHistoryFixture ( {
600
+ ...sub . categories . seerAutofix ,
601
+ reserved : RESERVED_BUDGET_QUOTA ,
602
+ } ) ,
603
+ seerScanner : MetricHistoryFixture ( {
604
+ ...sub . categories . seerScanner ,
605
+ reserved : RESERVED_BUDGET_QUOTA ,
606
+ } ) ,
607
+ } ;
608
+
609
+ render ( < PendingChanges organization = { organization } subscription = { sub } /> ) ;
610
+
611
+ expect ( screen . getByText ( 'Seer product access will be disabled' ) ) . toBeInTheDocument ( ) ;
612
+ expect ( screen . queryByText ( 'Seer budget' ) ) . not . toBeInTheDocument ( ) ;
613
+ expect ( screen . queryByText ( / R e s e r v e d i s s u e f i x e s / ) ) . not . toBeInTheDocument ( ) ;
614
+ expect ( screen . queryByText ( / R e s e r v e d i s s u e s c a n s / ) ) . not . toBeInTheDocument ( ) ;
546
615
} ) ;
547
616
548
617
it ( 'renders multiple reserved budgets' , function ( ) {
@@ -580,10 +649,11 @@ describe('Subscription > PendingChanges', function () {
580
649
581
650
expect ( screen . queryByText ( 'cost-per-event' ) ) . not . toBeInTheDocument ( ) ;
582
651
expect (
583
- screen . getByText (
584
- 'Spans Budget updated to $50,000 and Errors Budget updated to $10,000'
585
- )
652
+ screen . getByText ( 'Spans budget change from $100,000 to $50,000' )
586
653
) . toBeInTheDocument ( ) ;
654
+ expect ( screen . getByText ( 'Errors budget change to $10,000' ) ) . toBeInTheDocument ( ) ;
655
+ expect ( screen . queryByText ( / R e s e r v e d s p a n s / ) ) . not . toBeInTheDocument ( ) ;
656
+ expect ( screen . queryByText ( / R e s e r v e d e r r o r s / ) ) . not . toBeInTheDocument ( ) ;
587
657
} ) ;
588
658
589
659
it ( 'renders reserved budgets without existing budgets' , function ( ) {
@@ -615,7 +685,8 @@ describe('Subscription > PendingChanges', function () {
615
685
expect ( screen . queryByText ( 'accepted spans' ) ) . not . toBeInTheDocument ( ) ;
616
686
expect ( screen . queryByText ( 'stored spans' ) ) . not . toBeInTheDocument ( ) ;
617
687
expect ( screen . queryByText ( 'cost-per-event' ) ) . not . toBeInTheDocument ( ) ;
618
- expect ( screen . getByText ( 'Spans Budget updated to $50,000' ) ) . toBeInTheDocument ( ) ;
688
+ expect ( screen . getByText ( 'Spans budget change to $50,000' ) ) . toBeInTheDocument ( ) ;
689
+ expect ( screen . queryByText ( / R e s e r v e d s p a n s / ) ) . not . toBeInTheDocument ( ) ;
619
690
expect ( screen . getByText ( 'Plan change to Enterprise (Business)' ) ) . toBeInTheDocument ( ) ;
620
691
} ) ;
621
692
@@ -637,7 +708,7 @@ describe('Subscription > PendingChanges', function () {
637
708
expect ( screen . queryByText ( 'accepted spans' ) ) . not . toBeInTheDocument ( ) ;
638
709
expect ( screen . queryByText ( 'stored spans' ) ) . not . toBeInTheDocument ( ) ;
639
710
expect ( screen . queryByText ( 'cost-per-event' ) ) . not . toBeInTheDocument ( ) ;
640
- expect ( screen . queryByText ( 'Spans Budget ' ) ) . not . toBeInTheDocument ( ) ;
711
+ expect ( screen . queryByText ( 'Spans budget ' ) ) . not . toBeInTheDocument ( ) ;
641
712
expect ( screen . getByText ( 'Reserved spans change to 10,000,000' ) ) . toBeInTheDocument ( ) ;
642
713
expect ( screen . getByText ( 'Plan change to Enterprise (Business)' ) ) . toBeInTheDocument ( ) ;
643
714
} ) ;
0 commit comments