@@ -105,7 +105,7 @@ describe('Pay webhook', () => {
105105 let businessOperationsCollection : Collection < BusinessOperationDBScheme > ;
106106 let workspacesCollection : Collection < WorkspaceDBScheme > ;
107107 let tariffPlanCollection : Collection < PlanDBScheme > ;
108- let accountingCollection : Collection ;
108+ // let accountingCollection: Collection;
109109 let transactionsCollection : Collection ;
110110
111111 beforeAll ( async ( ) => {
@@ -140,7 +140,7 @@ describe('Pay webhook', () => {
140140 tariffPlanCollection = accountsDb . collection ( 'plans' ) ;
141141
142142 transactionsCollection = accountingDb . collection ( 'transactions' ) ;
143- accountingCollection = accountingDb . collection ( 'accounts' ) ;
143+ // accountingCollection = accountingDb.collection('accounts');
144144 } ) ;
145145
146146 beforeEach ( async ( ) => {
@@ -180,7 +180,7 @@ describe('Pay webhook', () => {
180180 /**
181181 * Add necessary accounts to accounting system
182182 */
183- await accountingCollection . insertMany ( [ cashbookAccount , revenueAccount , workspaceAccount ] ) ;
183+ // await accountingCollection.insertMany([cashbookAccount, revenueAccount, workspaceAccount]);
184184 } ) ;
185185
186186 afterEach ( async ( ) => {
@@ -251,32 +251,32 @@ describe('Pay webhook', () => {
251251 expect ( apiResponse . data . code ) . toBe ( PayCodes . SUCCESS ) ;
252252 } ) ;
253253
254- test ( 'Should associate an account with a workspace if the workspace did not have one' , async ( ) => {
255- /**
256- * Remove accountId from existed workspace
257- */
258- await workspacesCollection . updateOne (
259- { _id : workspace . _id } ,
260- {
261- $unset : {
262- accountId : '' ,
263- } ,
264- }
265- ) ;
266-
267- const apiResponse = await apiInstance . post ( '/billing/pay' , request ) ;
268-
269- /**
270- * Check that account is created and linked
271- */
272- const updatedWorkspace = await workspacesCollection . findOne ( { _id : workspace . _id } ) ;
273- const accountId = updatedWorkspace ?. accountId ;
274- const account = await accountingCollection . findOne ( { id : accountId } ) ;
275-
276- expect ( typeof accountId ) . toBe ( 'string' ) ;
277- expect ( account ) . toBeTruthy ( ) ;
278- expect ( apiResponse . data . code ) . toBe ( PayCodes . SUCCESS ) ;
279- } ) ;
254+ // test('Should associate an account with a workspace if the workspace did not have one', async () => {
255+ // /**
256+ // * Remove accountId from existed workspace
257+ // */
258+ // await workspacesCollection.updateOne(
259+ // { _id: workspace._id },
260+ // {
261+ // $unset: {
262+ // accountId: '',
263+ // },
264+ // }
265+ // );
266+
267+ // const apiResponse = await apiInstance.post('/billing/pay', request);
268+
269+ // /**
270+ // * Check that account is created and linked
271+ // */
272+ // const updatedWorkspace = await workspacesCollection.findOne({ _id: workspace._id });
273+ // const accountId = updatedWorkspace?.accountId;
274+ // const account = await accountingCollection.findOne({ id: accountId });
275+
276+ // expect(typeof accountId).toBe('string');
277+ // expect(account).toBeTruthy();
278+ // expect(apiResponse.data.code).toBe(PayCodes.SUCCESS);
279+ // });
280280
281281 test ( 'Should add payment data to accounting system' , async ( ) => {
282282 const apiResponse = await apiInstance . post ( '/billing/pay' , request ) ;
@@ -374,32 +374,32 @@ describe('Pay webhook', () => {
374374 expect ( apiResponse . data . code ) . toBe ( PayCodes . SUCCESS ) ;
375375 } ) ;
376376
377- test ( 'Should associate an account with a workspace if the workspace did not have one' , async ( ) => {
378- /**
379- * Remove accountId from existed workspace
380- */
381- await workspacesCollection . updateOne (
382- { _id : workspace . _id } ,
383- {
384- $unset : {
385- accountId : '' ,
386- } ,
387- }
388- ) ;
389-
390- const apiResponse = await apiInstance . post ( '/billing/pay' , validPayRequestData ) ;
391-
392- /**
393- * Check that account is created and linked
394- */
395- const updatedWorkspace = await workspacesCollection . findOne ( { _id : workspace . _id } ) ;
396- const accountId = updatedWorkspace ?. accountId ;
397- const account = await accountingCollection . findOne ( { id : accountId } ) ;
398-
399- expect ( typeof accountId ) . toBe ( 'string' ) ;
400- expect ( account ) . toBeTruthy ( ) ;
401- expect ( apiResponse . data . code ) . toBe ( PayCodes . SUCCESS ) ;
402- } ) ;
377+ // test('Should associate an account with a workspace if the workspace did not have one', async () => {
378+ // /**
379+ // * Remove accountId from existed workspace
380+ // */
381+ // await workspacesCollection.updateOne(
382+ // { _id: workspace._id },
383+ // {
384+ // $unset: {
385+ // accountId: '',
386+ // },
387+ // }
388+ // );
389+
390+ // const apiResponse = await apiInstance.post('/billing/pay', validPayRequestData);
391+
392+ // /**
393+ // * Check that account is created and linked
394+ // */
395+ // const updatedWorkspace = await workspacesCollection.findOne({ _id: workspace._id });
396+ // const accountId = updatedWorkspace?.accountId;
397+ // const account = await accountingCollection.findOne({ id: accountId });
398+
399+ // expect(typeof accountId).toBe('string');
400+ // expect(account).toBeTruthy();
401+ // expect(apiResponse.data.code).toBe(PayCodes.SUCCESS);
402+ // });
403403
404404 test ( 'Should add payment data to accounting system' , async ( ) => {
405405 const apiResponse = await apiInstance . post ( '/billing/pay' , validPayRequestData ) ;
0 commit comments