@@ -31,7 +31,7 @@ function createComposePaymentTestSetup(options: {
3131 const userId = new ObjectId ( ) . toString ( ) ;
3232 const workspaceId = new ObjectId ( ) . toString ( ) ;
3333 const planId = new ObjectId ( ) . toString ( ) ;
34-
34+
3535 const plan : PlanDBScheme = {
3636 _id : new ObjectId ( planId ) ,
3737 name : 'Test Plan' ,
@@ -41,7 +41,7 @@ function createComposePaymentTestSetup(options: {
4141 isDefault : false ,
4242 isHidden : false ,
4343 } ;
44-
44+
4545 const workspace : WorkspaceDBScheme = {
4646 _id : new ObjectId ( workspaceId ) ,
4747 name : 'Test Workspace' ,
@@ -71,7 +71,7 @@ function createComposePaymentTestSetup(options: {
7171 } ;
7272
7373 const mockContext : ResolverContextWithUser = {
74- user : {
74+ user : {
7575 id : userId ,
7676 accessTokenExpired : false ,
7777 } ,
@@ -81,6 +81,7 @@ function createComposePaymentTestSetup(options: {
8181 usersFactory : { } as any ,
8282 projectsFactory : { } as any ,
8383 businessOperationsFactory : { } as any ,
84+ releasesFactory : { } as any ,
8485 } ,
8586 } ;
8687
@@ -102,7 +103,7 @@ describe('GraphQLBillingNew', () => {
102103 // Create 2 months ago date
103104 const expiredDate = new Date ( ) ;
104105 expiredDate . setMonth ( expiredDate . getMonth ( ) - 2 ) ;
105-
106+
106107 const { mockContext, planId, workspaceId } = createComposePaymentTestSetup ( {
107108 isTariffPlanExpired : true ,
108109 isBlocked : false ,
@@ -123,22 +124,22 @@ describe('GraphQLBillingNew', () => {
123124 ) ;
124125
125126 expect ( result . isCardLinkOperation ) . toBe ( false ) ;
126-
127+
127128 // Check that nextPaymentDate is one month from now
128129 const oneMonthFromNow = new Date ( ) ;
129-
130+
130131 oneMonthFromNow . setMonth ( oneMonthFromNow . getMonth ( ) + 1 ) ;
131132
132133 const oneMonthFromNowStr = oneMonthFromNow . toISOString ( ) . split ( 'T' ) [ 0 ] ;
133134 const nextPaymentDateStr = result . nextPaymentDate . toISOString ( ) . split ( 'T' ) [ 0 ] ;
134-
135+
135136 expect ( nextPaymentDateStr ) . toBe ( oneMonthFromNowStr ) ;
136137 } ) ;
137138
138139 it ( 'should return isCardLinkOperation = true in case of active tariff plan' , async ( ) => {
139140 // Create 2 days ago date
140141 const lastChargeDate = new Date ( Date . now ( ) - 2 * 24 * 60 * 60 * 1000 ) ;
141-
142+
142143 const { mockContext, planId, workspaceId, workspace } = createComposePaymentTestSetup ( {
143144 isTariffPlanExpired : false ,
144145 isBlocked : false ,
@@ -158,7 +159,7 @@ describe('GraphQLBillingNew', () => {
158159 ) ;
159160
160161 expect ( result . isCardLinkOperation ) . toBe ( true ) ;
161-
162+
162163 const oneMonthFromLastChargeDate = new Date ( workspace . lastChargeDate ) ;
163164 oneMonthFromLastChargeDate . setMonth ( oneMonthFromLastChargeDate . getMonth ( ) + 1 ) ;
164165
@@ -173,7 +174,7 @@ describe('GraphQLBillingNew', () => {
173174 isBlocked : true ,
174175 lastChargeDate : new Date ( ) ,
175176 } ) ;
176-
177+
177178 const result = await billingNewResolver . Query . composePayment (
178179 undefined ,
179180 {
@@ -185,17 +186,17 @@ describe('GraphQLBillingNew', () => {
185186 } ,
186187 mockContext
187188 ) ;
188-
189+
189190 expect ( result . isCardLinkOperation ) . toBe ( false ) ;
190191
191192 // Check that nextPaymentDate is one month from now
192193 const oneMonthFromNow = new Date ( ) ;
193-
194+
194195 oneMonthFromNow . setMonth ( oneMonthFromNow . getMonth ( ) + 1 ) ;
195196
196197 const oneMonthFromNowStr = oneMonthFromNow . toISOString ( ) . split ( 'T' ) [ 0 ] ;
197198 const nextPaymentDateStr = result . nextPaymentDate . toISOString ( ) . split ( 'T' ) [ 0 ] ;
198-
199+
199200 expect ( nextPaymentDateStr ) . toBe ( oneMonthFromNowStr ) ;
200201 } ) ;
201202 } ) ;
0 commit comments