Skip to content

Commit 32085ea

Browse files
committed
test(billing): use inactive instead of disabled for plan state
1 parent da33cd1 commit 32085ea

2 files changed

Lines changed: 14 additions & 14 deletions

File tree

internal/api/v1beta1connect/billing_plan_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ func TestConnectHandler_UpdatePlan(t *testing.T) {
631631
Description: "updated",
632632
OnStartCredits: 500,
633633
TrialDays: 14,
634-
State: "disabled",
634+
State: "inactive",
635635
Metadata: testMetadata,
636636
},
637637
}),
@@ -642,7 +642,7 @@ func TestConnectHandler_UpdatePlan(t *testing.T) {
642642
Description: "updated",
643643
OnStartCredits: 500,
644644
TrialDays: 14,
645-
State: "disabled",
645+
State: "inactive",
646646
Metadata: metadata.Metadata{"key1": "value1"},
647647
}).Return(plan.Plan{
648648
ID: "plan-1",
@@ -651,7 +651,7 @@ func TestConnectHandler_UpdatePlan(t *testing.T) {
651651
Description: "updated",
652652
OnStartCredits: 500,
653653
TrialDays: 14,
654-
State: "disabled",
654+
State: "inactive",
655655
CreatedAt: time.Date(2023, 1, 1, 0, 0, 0, 0, time.UTC),
656656
UpdatedAt: time.Date(2023, 1, 3, 0, 0, 0, 0, time.UTC),
657657
}, nil)
@@ -664,7 +664,7 @@ func TestConnectHandler_UpdatePlan(t *testing.T) {
664664
Description: "updated",
665665
OnStartCredits: 500,
666666
TrialDays: 14,
667-
State: "disabled",
667+
State: "inactive",
668668
CreatedAt: timestamppb.New(time.Date(2023, 1, 1, 0, 0, 0, 0, time.UTC)),
669669
UpdatedAt: timestamppb.New(time.Date(2023, 1, 3, 0, 0, 0, 0, time.UTC)),
670670
},
@@ -727,7 +727,7 @@ func TestConnectHandler_ListAllPlans(t *testing.T) {
727727
ID: "plan-2",
728728
Name: "old-plan",
729729
Title: "Old Plan",
730-
State: "disabled",
730+
State: "inactive",
731731
Products: []product.Product{},
732732
Metadata: metadata.Metadata{},
733733
CreatedAt: time.Date(2023, 2, 1, 0, 0, 0, 0, time.UTC),
@@ -749,7 +749,7 @@ func TestConnectHandler_ListAllPlans(t *testing.T) {
749749
Id: "plan-2",
750750
Name: "old-plan",
751751
Title: "Old Plan",
752-
State: "disabled",
752+
State: "inactive",
753753
CreatedAt: timestamppb.New(time.Date(2023, 2, 1, 0, 0, 0, 0, time.UTC)),
754754
UpdatedAt: timestamppb.New(time.Date(2023, 2, 2, 0, 0, 0, 0, time.UTC)),
755755
},
@@ -758,9 +758,9 @@ func TestConnectHandler_ListAllPlans(t *testing.T) {
758758
},
759759
{
760760
name: "should pass a set state through as a filter",
761-
request: connect.NewRequest(&frontierv1beta1.ListAllPlansRequest{State: "disabled"}),
761+
request: connect.NewRequest(&frontierv1beta1.ListAllPlansRequest{State: "inactive"}),
762762
setup: func(ps *mocks.PlanService) {
763-
ps.On("List", mock.Anything, plan.Filter{State: "disabled"}).Return([]plan.Plan{}, nil)
763+
ps.On("List", mock.Anything, plan.Filter{State: "inactive"}).Return([]plan.Plan{}, nil)
764764
},
765765
want: connect.NewResponse(&frontierv1beta1.ListAllPlansResponse{Plans: nil}),
766766
},

test/e2e/regression/billing_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -353,13 +353,13 @@ func (s *BillingRegressionTestSuite) TestPlansAPI() {
353353
Body: &frontierv1beta1.UpdatePlanRequestBody{
354354
Title: "Test Plan 2 Renamed",
355355
Description: "Test Plan 2 Renamed",
356-
State: "disabled",
356+
State: "inactive",
357357
},
358358
}))
359359
s.Assert().NoError(err)
360360
s.Assert().NotNil(updatePlanResp)
361361
s.Assert().Equal("Test Plan 2 Renamed", updatePlanResp.Msg.GetPlan().GetTitle())
362-
s.Assert().Equal("disabled", updatePlanResp.Msg.GetPlan().GetState())
362+
s.Assert().Equal("inactive", updatePlanResp.Msg.GetPlan().GetState())
363363
// UpdatePlan does not touch a plan's products
364364
s.Assert().NotEmpty(updatePlanResp.Msg.GetPlan().GetProducts())
365365
})
@@ -371,21 +371,21 @@ func (s *BillingRegressionTestSuite) TestPlansAPI() {
371371
s.Assert().Error(err)
372372
s.Assert().Equal(connect.CodeNotFound, connect.CodeOf(err))
373373
})
374-
s.Run("5. list all plans surfaces the disabled plan, ListPlans hides it", func() {
374+
s.Run("5. list all plans surfaces the inactive plan, ListPlans hides it", func() {
375375
// ListPlans returns active plans only
376376
listPlansResp, err := s.testBench.Client.ListPlans(ctxOrgAdminAuth, connect.NewRequest(&frontierv1beta1.ListPlansRequest{}))
377377
s.Assert().NoError(err)
378378
s.Assert().False(hasPlanNamed(listPlansResp.Msg.GetPlans(), "test-plan-2"))
379379

380-
// ListAllPlans with an empty state returns every plan, including disabled ones
380+
// ListAllPlans with an empty state returns every plan, including inactive ones
381381
listAllResp, err := s.testBench.AdminClient.ListAllPlans(ctxOrgAdminAuth, connect.NewRequest(&frontierv1beta1.ListAllPlansRequest{}))
382382
s.Assert().NoError(err)
383383
s.Assert().True(hasPlanNamed(listAllResp.Msg.GetPlans(), "test-plan-2"))
384384

385385
// the state filter narrows to a single state
386-
listDisabledResp, err := s.testBench.AdminClient.ListAllPlans(ctxOrgAdminAuth, connect.NewRequest(&frontierv1beta1.ListAllPlansRequest{State: "disabled"}))
386+
listInactiveResp, err := s.testBench.AdminClient.ListAllPlans(ctxOrgAdminAuth, connect.NewRequest(&frontierv1beta1.ListAllPlansRequest{State: "inactive"}))
387387
s.Assert().NoError(err)
388-
s.Assert().True(hasPlanNamed(listDisabledResp.Msg.GetPlans(), "test-plan-2"))
388+
s.Assert().True(hasPlanNamed(listInactiveResp.Msg.GetPlans(), "test-plan-2"))
389389
})
390390
}
391391

0 commit comments

Comments
 (0)