@@ -338,8 +338,8 @@ describe("updateQuantitySubscriptionFromStripe", () => {
338338 describe ( "For an organization" , ( ) => {
339339 it ( "should not update subscription when team members are less than metadata.orgSeats" , async ( ) => {
340340 const FAKE_PAYMENT_ID = "FAKE_PAYMENT_ID" ;
341- const FAKE_SUBITEM_ID = "si_FAKE_SUBITEM_ID " ;
342- const FAKE_SUB_ID = "sub_FAKE_SUB_ID " ;
341+ const FAKE_SUBITEM_ID = "FAKE_SUBITEM_ID " ;
342+ const FAKE_SUB_ID = "FAKE_SUB_ID " ;
343343 const FAKE_SUBSCRIPTION_QTY_IN_STRIPE = 1000 ;
344344 const consoleInfoSpy = vi . spyOn ( console , "info" ) ;
345345
@@ -363,7 +363,7 @@ describe("updateQuantitySubscriptionFromStripe", () => {
363363 items : {
364364 data : [
365365 {
366- id : FAKE_SUBITEM_ID ,
366+ id : " FAKE_SUBITEM_ID" ,
367367 quantity : FAKE_SUBSCRIPTION_QTY_IN_STRIPE ,
368368 } ,
369369 ] ,
@@ -384,8 +384,8 @@ describe("updateQuantitySubscriptionFromStripe", () => {
384384
385385 it ( "should update subscription when team members are more than metadata.orgSeats" , async ( ) => {
386386 const FAKE_PAYMENT_ID = "FAKE_PAYMENT_ID" ;
387- const FAKE_SUBITEM_ID = "si_FAKE_SUBITEM_ID " ;
388- const FAKE_SUB_ID = "sub_FAKE_SUB_ID " ;
387+ const FAKE_SUB_ID = "FAKE_SUB_ID " ;
388+ const FAKE_SUBITEM_ID = "FAKE_SUBITEM_ID " ;
389389 const FAKE_SUBSCRIPTION_QTY_IN_STRIPE = 1000 ;
390390 const membersInTeam = 4 ;
391391 const organization = await createOrgWithMembersAndPaymentData ( {
@@ -434,8 +434,8 @@ describe("updateQuantitySubscriptionFromStripe", () => {
434434
435435 it ( "should not update subscription when team members are less than MINIMUM_NUMBER_OF_ORG_SEATS(if metadata.orgSeats is null)" , async ( ) => {
436436 const FAKE_PAYMENT_ID = "FAKE_PAYMENT_ID" ;
437- const FAKE_SUBITEM_ID = "si_FAKE_SUBITEM_ID " ;
438- const FAKE_SUB_ID = "sub_FAKE_SUB_ID " ;
437+ const FAKE_SUBITEM_ID = "FAKE_SUBITEM_ID " ;
438+ const FAKE_SUB_ID = "FAKE_SUB_ID " ;
439439 const FAKE_SUBSCRIPTION_QTY_IN_STRIPE = 1000 ;
440440 const membersInTeam = 2 ;
441441 const consoleInfoSpy = vi . spyOn ( console , "info" ) ;
@@ -453,7 +453,7 @@ describe("updateQuantitySubscriptionFromStripe", () => {
453453 items : {
454454 data : [
455455 {
456- id : FAKE_SUBITEM_ID ,
456+ id : " FAKE_SUBITEM_ID" ,
457457 quantity : FAKE_SUBSCRIPTION_QTY_IN_STRIPE ,
458458 } ,
459459 ] ,
@@ -480,8 +480,8 @@ describe("updateQuantitySubscriptionFromStripe", () => {
480480
481481 it ( "should update subscription when team members are more than MINIMUM_NUMBER_OF_ORG_SEATS(if metadata.orgSeats is null)" , async ( ) => {
482482 const FAKE_PAYMENT_ID = "FAKE_PAYMENT_ID" ;
483- const FAKE_SUBITEM_ID = "si_FAKE_SUBITEM_ID " ;
484- const FAKE_SUB_ID = "sub_FAKE_SUB_ID " ;
483+ const FAKE_SUB_ID = "FAKE_SUB_ID " ;
484+ const FAKE_SUBITEM_ID = "FAKE_SUBITEM_ID " ;
485485 const FAKE_SUBSCRIPTION_QTY_IN_STRIPE = 1000 ;
486486 const membersInTeam = 35 ;
487487 const organization = await createOrgWithMembersAndPaymentData ( {
@@ -537,8 +537,8 @@ describe("getTeamWithPaymentMetadata", () => {
537537 isOrganization : true ,
538538 name : "TestTeam" ,
539539 metadata : {
540- subscriptionId : "sub_FAKE_SUB_ID " ,
541- subscriptionItemId : "si_FAKE_SUB_ITEM_ID " ,
540+ subscriptionId : "FAKE_SUB_ID " ,
541+ subscriptionItemId : "FAKE_SUB_ITEM_ID " ,
542542 } ,
543543 } ,
544544 } ) ;
@@ -552,7 +552,7 @@ describe("getTeamWithPaymentMetadata", () => {
552552 name : "TestTeam" ,
553553 metadata : {
554554 paymentId : "FAKE_PAY_ID" ,
555- subscriptionItemId : "si_FAKE_SUB_ITEM_ID " ,
555+ subscriptionItemId : "FAKE_SUB_ITEM_ID " ,
556556 } ,
557557 } ,
558558 } ) ;
@@ -566,7 +566,7 @@ describe("getTeamWithPaymentMetadata", () => {
566566 name : "TestTeam" ,
567567 metadata : {
568568 paymentId : "FAKE_PAY_ID" ,
569- subscriptionId : "sub_FAKE_SUB_ID " ,
569+ subscriptionId : "FAKE_SUB_ID " ,
570570 } ,
571571 } ,
572572 } ) ;
@@ -580,8 +580,8 @@ describe("getTeamWithPaymentMetadata", () => {
580580 name : "TestTeam" ,
581581 metadata : {
582582 paymentId : "FAKE_PAY_ID" ,
583- subscriptionId : "sub_FAKE_SUB_ID " ,
584- subscriptionItemId : "si_FAKE_SUB_ITEM_ID " ,
583+ subscriptionId : "FAKE_SUB_ID " ,
584+ subscriptionItemId : "FAKE_SUB_ITEM_ID " ,
585585 } ,
586586 } ,
587587 } ) ;
@@ -597,65 +597,14 @@ describe("getTeamWithPaymentMetadata", () => {
597597 metadata : {
598598 orgSeats : 5 ,
599599 paymentId : "FAKE_PAY_ID" ,
600- subscriptionId : "sub_FAKE_SUB_ID " ,
601- subscriptionItemId : "si_FAKE_SUB_ITEM_ID " ,
600+ subscriptionId : "FAKE_SUB_ID " ,
601+ subscriptionItemId : "FAKE_SUB_ITEM_ID " ,
602602 } ,
603603 } ,
604604 } ) ;
605605 const teamWithPaymentData = await getTeamWithPaymentMetadata ( team . id ) ;
606606 expect ( teamWithPaymentData . metadata . orgSeats ) . toEqual ( 5 ) ;
607607 } ) ;
608-
609- it ( "should error if subscriptionId doesn't start with 'sub_'" , async ( ) => {
610- const team = await prismock . team . create ( {
611- data : {
612- isOrganization : true ,
613- name : "TestTeam" ,
614- metadata : {
615- paymentId : "FAKE_PAY_ID" ,
616- subscriptionId : "invalid_sub_id" ,
617- subscriptionItemId : "si_FAKE_SUB_ITEM_ID" ,
618- } ,
619- } ,
620- } ) ;
621- expect ( ( ) => getTeamWithPaymentMetadata ( team . id ) ) . rejects . toThrow (
622- "subscriptionId must start with 'sub_'"
623- ) ;
624- } ) ;
625-
626- it ( "should error if subscriptionItemId doesn't start with 'si_'" , async ( ) => {
627- const team = await prismock . team . create ( {
628- data : {
629- isOrganization : true ,
630- name : "TestTeam" ,
631- metadata : {
632- paymentId : "FAKE_PAY_ID" ,
633- subscriptionId : "sub_FAKE_SUB_ID" ,
634- subscriptionItemId : "invalid_item_id" ,
635- } ,
636- } ,
637- } ) ;
638- expect ( ( ) => getTeamWithPaymentMetadata ( team . id ) ) . rejects . toThrow (
639- "subscriptionItemId must start with 'si_'"
640- ) ;
641- } ) ;
642-
643- it ( "should parse successfully with valid prefixes" , async ( ) => {
644- const team = await prismock . team . create ( {
645- data : {
646- isOrganization : true ,
647- name : "TestTeam" ,
648- metadata : {
649- paymentId : "FAKE_PAY_ID" ,
650- subscriptionId : "sub_FAKE_SUB_ID" ,
651- subscriptionItemId : "si_FAKE_SUB_ITEM_ID" ,
652- } ,
653- } ,
654- } ) ;
655- const teamWithPaymentData = await getTeamWithPaymentMetadata ( team . id ) ;
656- expect ( teamWithPaymentData . metadata . subscriptionId ) . toEqual ( "sub_FAKE_SUB_ID" ) ;
657- expect ( teamWithPaymentData . metadata . subscriptionItemId ) . toEqual ( "si_FAKE_SUB_ITEM_ID" ) ;
658- } ) ;
659608} ) ;
660609
661610async function createOrgWithMembersAndPaymentData ( {
0 commit comments