@@ -19,15 +19,15 @@ const DEFAULT_BILLING_STATUS: BillingStatusResponse = {
1919
2020const {
2121 mockTeamWorkspacesEnabled,
22- mockBillingControlEnabled ,
22+ mockConsolidatedBillingEnabled ,
2323 mockIsPersonal,
2424 mockPlans,
2525 mockPurchaseCredits,
2626 mockUpdateActiveWorkspace,
2727 mockBillingStatus
2828} = vi . hoisted ( ( ) => ( {
2929 mockTeamWorkspacesEnabled : { value : false } ,
30- mockBillingControlEnabled : { value : false } ,
30+ mockConsolidatedBillingEnabled : { value : false } ,
3131 mockIsPersonal : { value : true } ,
3232 mockPlans : { value : [ ] as Plan [ ] } ,
3333 mockPurchaseCredits : vi . fn ( ) ,
@@ -59,11 +59,13 @@ vi.mock('@/composables/useFeatureFlags', async () => {
5959 teamWorkspacesEnabledRef . value = value
6060 }
6161 } )
62- const billingControlEnabledRef = ref ( mockBillingControlEnabled . value )
63- Object . defineProperty ( mockBillingControlEnabled , 'value' , {
64- get : ( ) => billingControlEnabledRef . value ,
62+ const consolidatedBillingEnabledRef = ref (
63+ mockConsolidatedBillingEnabled . value
64+ )
65+ Object . defineProperty ( mockConsolidatedBillingEnabled , 'value' , {
66+ get : ( ) => consolidatedBillingEnabledRef . value ,
6567 set : ( value : boolean ) => {
66- billingControlEnabledRef . value = value
68+ consolidatedBillingEnabledRef . value = value
6769 }
6870 } )
6971 return {
@@ -72,8 +74,8 @@ vi.mock('@/composables/useFeatureFlags', async () => {
7274 get teamWorkspacesEnabled ( ) {
7375 return mockTeamWorkspacesEnabled . value
7476 } ,
75- get billingControlEnabled ( ) {
76- return mockBillingControlEnabled . value
77+ get consolidatedBillingEnabled ( ) {
78+ return mockConsolidatedBillingEnabled . value
7779 }
7880 }
7981 } )
@@ -163,7 +165,7 @@ describe('useBillingContext', () => {
163165 setActivePinia ( createPinia ( ) )
164166 vi . clearAllMocks ( )
165167 mockTeamWorkspacesEnabled . value = false
166- mockBillingControlEnabled . value = false
168+ mockConsolidatedBillingEnabled . value = false
167169 mockIsPersonal . value = true
168170 mockPlans . value = [ ]
169171 mockBillingStatus . value = { ...DEFAULT_BILLING_STATUS }
@@ -175,27 +177,27 @@ describe('useBillingContext', () => {
175177 expect ( type . value ) . toBe ( 'legacy' )
176178 } )
177179
178- it ( 'keeps personal on legacy when billing control is disabled' , ( ) => {
180+ it ( 'keeps personal on legacy when consolidated billing is disabled' , ( ) => {
179181 mockTeamWorkspacesEnabled . value = true
180- mockBillingControlEnabled . value = false
182+ mockConsolidatedBillingEnabled . value = false
181183 mockIsPersonal . value = true
182184
183185 const { type } = useBillingContext ( )
184186 expect ( type . value ) . toBe ( 'legacy' )
185187 } )
186188
187- it ( 'selects workspace type for personal when billing control is enabled' , ( ) => {
189+ it ( 'selects workspace type for personal when consolidated billing is enabled' , ( ) => {
188190 mockTeamWorkspacesEnabled . value = true
189- mockBillingControlEnabled . value = true
191+ mockConsolidatedBillingEnabled . value = true
190192 mockIsPersonal . value = true
191193
192194 const { type } = useBillingContext ( )
193195 expect ( type . value ) . toBe ( 'workspace' )
194196 } )
195197
196- it ( 'selects workspace type for team regardless of billing control ' , ( ) => {
198+ it ( 'selects workspace type for team regardless of consolidated billing ' , ( ) => {
197199 mockTeamWorkspacesEnabled . value = true
198- mockBillingControlEnabled . value = false
200+ mockConsolidatedBillingEnabled . value = false
199201 mockIsPersonal . value = false
200202
201203 const { type } = useBillingContext ( )
@@ -296,7 +298,7 @@ describe('useBillingContext', () => {
296298 expect ( workspaceApi . getBillingStatus ) . not . toHaveBeenCalled ( )
297299
298300 // Authenticated remote config resolves the flag on for the same workspace
299- mockBillingControlEnabled . value = true
301+ mockConsolidatedBillingEnabled . value = true
300302 mockTeamWorkspacesEnabled . value = true
301303
302304 await vi . waitFor ( ( ) => {
@@ -305,16 +307,16 @@ describe('useBillingContext', () => {
305307 } )
306308 } )
307309
308- it ( 'moves a personal workspace to workspace billing when billing control flips on' , async ( ) => {
310+ it ( 'moves a personal workspace to workspace billing when consolidated billing flips on' , async ( ) => {
309311 mockTeamWorkspacesEnabled . value = true
310- mockBillingControlEnabled . value = false
312+ mockConsolidatedBillingEnabled . value = false
311313 mockIsPersonal . value = true
312314
313315 const { type } = useBillingContext ( )
314316 await nextTick ( )
315317 expect ( type . value ) . toBe ( 'legacy' )
316318
317- mockBillingControlEnabled . value = true
319+ mockConsolidatedBillingEnabled . value = true
318320
319321 await vi . waitFor ( ( ) => {
320322 expect ( type . value ) . toBe ( 'workspace' )
@@ -323,9 +325,9 @@ describe('useBillingContext', () => {
323325 } )
324326
325327 describe ( 'subscription mirror to workspace store' , ( ) => {
326- it ( 'mirrors subscription for personal workspaces on the billing control flow' , async ( ) => {
328+ it ( 'mirrors subscription for personal workspaces on the consolidated billing flow' , async ( ) => {
327329 mockTeamWorkspacesEnabled . value = true
328- mockBillingControlEnabled . value = true
330+ mockConsolidatedBillingEnabled . value = true
329331 mockIsPersonal . value = true
330332
331333 const { initialize } = useBillingContext ( )
@@ -587,7 +589,7 @@ describe('useBillingContext', () => {
587589
588590 it ( 'is true for a per-credit Team plan in a personal workspace before its credit stop is populated' , async ( ) => {
589591 mockTeamWorkspacesEnabled . value = true
590- mockBillingControlEnabled . value = true
592+ mockConsolidatedBillingEnabled . value = true
591593 mockIsPersonal . value = true
592594 mockBillingStatus . value = {
593595 is_active : true ,
0 commit comments