File tree Expand file tree Collapse file tree 1 file changed +56
-0
lines changed
src/pages/PlanPage/subRoutes/CurrentOrgPlan/BillingDetails/PaymentCard Expand file tree Collapse file tree 1 file changed +56
-0
lines changed Original file line number Diff line number Diff line change @@ -320,6 +320,62 @@ describe('PaymentCard', () => {
320320 expect ( screen . getByText ( / f o r \$ 3 0 .0 0 / ) ) . toBeInTheDocument ( )
321321 } )
322322 } )
323+
324+ describe ( 'nextBillPrice calculation' , ( ) => {
325+ it ( 'calculates monthly billing price correctly' , async ( ) => {
326+ // Test with monthly billing: baseUnitPrice 10, 3 paid seats = $30.00
327+ setup ( )
328+ render (
329+ < PaymentCard
330+ accountDetails = { accountDetails }
331+ provider = "gh"
332+ owner = "codecov"
333+ /> ,
334+ { wrapper }
335+ )
336+
337+ await waitFor ( ( ) => {
338+ expect ( screen . getByText ( / f o r \$ 3 0 .0 0 / ) ) . toBeInTheDocument ( )
339+ } )
340+ } )
341+
342+ it ( 'calculates annual billing price correctly' , async ( ) => {
343+ // Test with annual billing: baseUnitPrice 10, 3 paid seats × 12 = $360.00
344+ server . use (
345+ graphql . query ( 'GetPlanData' , ( ) => {
346+ return HttpResponse . json ( {
347+ data : {
348+ owner : {
349+ hasPrivateRepos : true ,
350+ plan : {
351+ ...mockPlanData ,
352+ billingRate : BillingRate . ANNUALLY ,
353+ baseUnitPrice : 10 ,
354+ planUserCount : 6 ,
355+ freeSeatCount : 2 ,
356+ isProPlan : false ,
357+ isTeamPlan : true ,
358+ } ,
359+ } ,
360+ } ,
361+ } )
362+ } )
363+ )
364+
365+ render (
366+ < PaymentCard
367+ accountDetails = { accountDetails }
368+ provider = "gh"
369+ owner = "codecov"
370+ /> ,
371+ { wrapper }
372+ )
373+
374+ await waitFor ( ( ) => {
375+ expect ( screen . getByText ( / f o r \$ 4 8 0 .0 0 / ) ) . toBeInTheDocument ( )
376+ } )
377+ } )
378+ } )
323379 } )
324380
325381 describe ( 'when the user has a US bank account' , ( ) => {
You can’t perform that action at this time.
0 commit comments