1
1
import { format , lastDayOfMonth , setDate } from 'date-fns' ;
2
2
import Onyx from 'react-native-onyx' ;
3
3
import DateUtils from '@libs/DateUtils' ;
4
- import * as NextStepUtils from '@libs/NextStepUtils' ;
5
- import * as ReportUtils from '@libs/ReportUtils' ;
4
+ import { buildNextStep } from '@libs/NextStepUtils' ;
5
+ import { buildOptimisticExpenseReport } from '@libs/ReportUtils' ;
6
6
import CONST from '@src/CONST' ;
7
7
import ONYXKEYS from '@src/ONYXKEYS' ;
8
8
import type { Policy , Report , ReportNextStep } from '@src/types/onyx' ;
@@ -40,8 +40,7 @@ describe('libs/NextStepUtils', () => {
40
40
icon : CONST . NEXT_STEP . ICONS . HOURGLASS ,
41
41
message : [ ] ,
42
42
} ;
43
- const report = ReportUtils . buildOptimisticExpenseReport ( 'fake-chat-report-id-1' , policyID , 1 , - 500 , CONST . CURRENCY . USD ) as Report ;
44
- const report2 = ReportUtils . buildOptimisticExpenseReport ( 'fake-chat-report-id-2' , policyID , 1 , 0 , CONST . CURRENCY . USD ) as Report ;
43
+ const report = buildOptimisticExpenseReport ( 'fake-chat-report-id-1' , policyID , 1 , - 500 , CONST . CURRENCY . USD ) as Report ;
45
44
46
45
beforeAll ( ( ) => {
47
46
const policyCollectionDataSet = toCollectionDataSet ( ONYXKEYS . COLLECTION . POLICY , [ policy ] , ( item ) => item . id ) ;
@@ -102,7 +101,7 @@ describe('libs/NextStepUtils', () => {
102
101
} ,
103
102
] ;
104
103
105
- const result = NextStepUtils . buildNextStep ( report , CONST . REPORT . STATUS_NUM . OPEN ) ;
104
+ const result = buildNextStep ( report , CONST . REPORT . STATUS_NUM . OPEN ) ;
106
105
107
106
expect ( result ) . toMatchObject ( optimisticNextStep ) ;
108
107
} ) ;
@@ -143,7 +142,7 @@ describe('libs/NextStepUtils', () => {
143
142
enabled : true ,
144
143
} ,
145
144
} ) . then ( ( ) => {
146
- const result = NextStepUtils . buildNextStep ( report , CONST . REPORT . STATUS_NUM . OPEN ) ;
145
+ const result = buildNextStep ( report , CONST . REPORT . STATUS_NUM . OPEN ) ;
147
146
148
147
expect ( result ) . toMatchObject ( optimisticNextStep ) ;
149
148
} ) ;
@@ -178,7 +177,7 @@ describe('libs/NextStepUtils', () => {
178
177
enabled : true ,
179
178
} ,
180
179
} ) . then ( ( ) => {
181
- const result = NextStepUtils . buildNextStep ( report , CONST . REPORT . STATUS_NUM . OPEN ) ;
180
+ const result = buildNextStep ( report , CONST . REPORT . STATUS_NUM . OPEN ) ;
182
181
183
182
expect ( result ) . toMatchObject ( optimisticNextStep ) ;
184
183
} ) ;
@@ -213,7 +212,7 @@ describe('libs/NextStepUtils', () => {
213
212
enabled : true ,
214
213
} ,
215
214
} ) . then ( ( ) => {
216
- const result = NextStepUtils . buildNextStep ( report , CONST . REPORT . STATUS_NUM . OPEN ) ;
215
+ const result = buildNextStep ( report , CONST . REPORT . STATUS_NUM . OPEN ) ;
217
216
218
217
expect ( result ) . toMatchObject ( optimisticNextStep ) ;
219
218
} ) ;
@@ -249,7 +248,7 @@ describe('libs/NextStepUtils', () => {
249
248
enabled : true ,
250
249
} ,
251
250
} ) . then ( ( ) => {
252
- const result = NextStepUtils . buildNextStep ( report , CONST . REPORT . STATUS_NUM . OPEN ) ;
251
+ const result = buildNextStep ( report , CONST . REPORT . STATUS_NUM . OPEN ) ;
253
252
254
253
expect ( result ) . toMatchObject ( optimisticNextStep ) ;
255
254
} ) ;
@@ -285,7 +284,7 @@ describe('libs/NextStepUtils', () => {
285
284
enabled : true ,
286
285
} ,
287
286
} ) . then ( ( ) => {
288
- const result = NextStepUtils . buildNextStep ( report , CONST . REPORT . STATUS_NUM . OPEN ) ;
287
+ const result = buildNextStep ( report , CONST . REPORT . STATUS_NUM . OPEN ) ;
289
288
290
289
expect ( result ) . toMatchObject ( optimisticNextStep ) ;
291
290
} ) ;
@@ -323,7 +322,7 @@ describe('libs/NextStepUtils', () => {
323
322
enabled : true ,
324
323
} ,
325
324
} ) . then ( ( ) => {
326
- const result = NextStepUtils . buildNextStep ( report , CONST . REPORT . STATUS_NUM . OPEN ) ;
325
+ const result = buildNextStep ( report , CONST . REPORT . STATUS_NUM . OPEN ) ;
327
326
328
327
expect ( result ) . toMatchObject ( optimisticNextStep ) ;
329
328
} ) ;
@@ -358,7 +357,7 @@ describe('libs/NextStepUtils', () => {
358
357
enabled : true ,
359
358
} ,
360
359
} ) . then ( ( ) => {
361
- const result = NextStepUtils . buildNextStep ( report , CONST . REPORT . STATUS_NUM . OPEN ) ;
360
+ const result = buildNextStep ( report , CONST . REPORT . STATUS_NUM . OPEN ) ;
362
361
363
362
expect ( result ) . toMatchObject ( optimisticNextStep ) ;
364
363
} ) ;
@@ -391,7 +390,7 @@ describe('libs/NextStepUtils', () => {
391
390
enabled : false ,
392
391
} ,
393
392
} ) . then ( ( ) => {
394
- const result = NextStepUtils . buildNextStep ( report , CONST . REPORT . STATUS_NUM . OPEN ) ;
393
+ const result = buildNextStep ( report , CONST . REPORT . STATUS_NUM . OPEN ) ;
395
394
396
395
expect ( result ) . toMatchObject ( optimisticNextStep ) ;
397
396
} ) ;
@@ -422,7 +421,7 @@ describe('libs/NextStepUtils', () => {
422
421
} ,
423
422
] ;
424
423
425
- const result = NextStepUtils . buildNextStep ( report , CONST . REPORT . STATUS_NUM . APPROVED ) ;
424
+ const result = buildNextStep ( report , CONST . REPORT . STATUS_NUM . APPROVED ) ;
426
425
427
426
expect ( result ) . toMatchObject ( optimisticNextStep ) ;
428
427
} ) ;
@@ -454,7 +453,7 @@ describe('libs/NextStepUtils', () => {
454
453
accountNumber : '123456789' ,
455
454
} ,
456
455
} ) . then ( ( ) => {
457
- const result = NextStepUtils . buildNextStep ( report , CONST . REPORT . STATUS_NUM . APPROVED ) ;
456
+ const result = buildNextStep ( report , CONST . REPORT . STATUS_NUM . APPROVED ) ;
458
457
459
458
expect ( result ) . toMatchObject ( optimisticNextStep ) ;
460
459
@@ -496,7 +495,7 @@ describe('libs/NextStepUtils', () => {
496
495
} ,
497
496
} ,
498
497
} ) . then ( ( ) => {
499
- const result = NextStepUtils . buildNextStep ( report , CONST . REPORT . STATUS_NUM . SUBMITTED ) ;
498
+ const result = buildNextStep ( report , CONST . REPORT . STATUS_NUM . SUBMITTED ) ;
500
499
501
500
expect ( result ) . toMatchObject ( optimisticNextStep ) ;
502
501
} ) ;
@@ -533,7 +532,7 @@ describe('libs/NextStepUtils', () => {
533
532
} ,
534
533
} ,
535
534
} ) . then ( ( ) => {
536
- const result = NextStepUtils . buildNextStep ( report , CONST . REPORT . STATUS_NUM . SUBMITTED ) ;
535
+ const result = buildNextStep ( report , CONST . REPORT . STATUS_NUM . SUBMITTED ) ;
537
536
538
537
expect ( result ) . toMatchObject ( optimisticNextStep ) ;
539
538
} ) ;
@@ -550,7 +549,7 @@ describe('libs/NextStepUtils', () => {
550
549
return Onyx . merge ( `${ ONYXKEYS . COLLECTION . POLICY } ${ policyID } ` , {
551
550
approvalMode : CONST . POLICY . APPROVAL_MODE . OPTIONAL ,
552
551
} ) . then ( ( ) => {
553
- const result = NextStepUtils . buildNextStep ( report , CONST . REPORT . STATUS_NUM . CLOSED ) ;
552
+ const result = buildNextStep ( report , CONST . REPORT . STATUS_NUM . CLOSED ) ;
554
553
555
554
expect ( result ) . toMatchObject ( optimisticNextStep ) ;
556
555
} ) ;
@@ -567,7 +566,7 @@ describe('libs/NextStepUtils', () => {
567
566
} ,
568
567
] ;
569
568
570
- const result = NextStepUtils . buildNextStep ( report , CONST . REPORT . STATUS_NUM . APPROVED ) ;
569
+ const result = buildNextStep ( report , CONST . REPORT . STATUS_NUM . APPROVED ) ;
571
570
572
571
expect ( result ) . toMatchObject ( optimisticNextStep ) ;
573
572
} ) ;
@@ -598,7 +597,7 @@ describe('libs/NextStepUtils', () => {
598
597
report . stateNum = CONST . REPORT . STATE_NUM . APPROVED ;
599
598
report . statusNum = CONST . REPORT . STATUS_NUM . APPROVED ;
600
599
601
- const result = NextStepUtils . buildNextStep ( report , CONST . REPORT . STATUS_NUM . APPROVED ) ;
600
+ const result = buildNextStep ( report , CONST . REPORT . STATUS_NUM . APPROVED ) ;
602
601
603
602
expect ( result ) . toMatchObject ( optimisticNextStep ) ;
604
603
@@ -634,7 +633,7 @@ describe('libs/NextStepUtils', () => {
634
633
accountNumber : '123456789' ,
635
634
} ,
636
635
} ) . then ( ( ) => {
637
- const result = NextStepUtils . buildNextStep ( report , CONST . REPORT . STATUS_NUM . APPROVED ) ;
636
+ const result = buildNextStep ( report , CONST . REPORT . STATUS_NUM . APPROVED ) ;
638
637
639
638
expect ( result ) . toMatchObject ( optimisticNextStep ) ;
640
639
} ) ;
@@ -649,7 +648,7 @@ describe('libs/NextStepUtils', () => {
649
648
} ,
650
649
] ;
651
650
652
- const result = NextStepUtils . buildNextStep ( report , CONST . REPORT . STATUS_NUM . REIMBURSED ) ;
651
+ const result = buildNextStep ( report , CONST . REPORT . STATUS_NUM . REIMBURSED ) ;
653
652
654
653
expect ( result ) . toMatchObject ( optimisticNextStep ) ;
655
654
} ) ;
0 commit comments