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,7 +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 ;
43
+ const report = buildOptimisticExpenseReport ( 'fake-chat-report-id-1' , policyID , 1 , - 500 , CONST . CURRENCY . USD ) as Report ;
44
44
45
45
beforeAll ( ( ) => {
46
46
const policyCollectionDataSet = toCollectionDataSet ( ONYXKEYS . COLLECTION . POLICY , [ policy ] , ( item ) => item . id ) ;
@@ -101,7 +101,7 @@ describe('libs/NextStepUtils', () => {
101
101
} ,
102
102
] ;
103
103
104
- const result = NextStepUtils . buildNextStep ( report , CONST . REPORT . STATUS_NUM . OPEN ) ;
104
+ const result = buildNextStep ( report , CONST . REPORT . STATUS_NUM . OPEN ) ;
105
105
106
106
expect ( result ) . toMatchObject ( optimisticNextStep ) ;
107
107
} ) ;
@@ -142,7 +142,7 @@ describe('libs/NextStepUtils', () => {
142
142
enabled : true ,
143
143
} ,
144
144
} ) . then ( ( ) => {
145
- const result = NextStepUtils . buildNextStep ( report , CONST . REPORT . STATUS_NUM . OPEN ) ;
145
+ const result = buildNextStep ( report , CONST . REPORT . STATUS_NUM . OPEN ) ;
146
146
147
147
expect ( result ) . toMatchObject ( optimisticNextStep ) ;
148
148
} ) ;
@@ -177,7 +177,7 @@ describe('libs/NextStepUtils', () => {
177
177
enabled : true ,
178
178
} ,
179
179
} ) . then ( ( ) => {
180
- const result = NextStepUtils . buildNextStep ( report , CONST . REPORT . STATUS_NUM . OPEN ) ;
180
+ const result = buildNextStep ( report , CONST . REPORT . STATUS_NUM . OPEN ) ;
181
181
182
182
expect ( result ) . toMatchObject ( optimisticNextStep ) ;
183
183
} ) ;
@@ -212,7 +212,7 @@ describe('libs/NextStepUtils', () => {
212
212
enabled : true ,
213
213
} ,
214
214
} ) . then ( ( ) => {
215
- const result = NextStepUtils . buildNextStep ( report , CONST . REPORT . STATUS_NUM . OPEN ) ;
215
+ const result = buildNextStep ( report , CONST . REPORT . STATUS_NUM . OPEN ) ;
216
216
217
217
expect ( result ) . toMatchObject ( optimisticNextStep ) ;
218
218
} ) ;
@@ -248,7 +248,7 @@ describe('libs/NextStepUtils', () => {
248
248
enabled : true ,
249
249
} ,
250
250
} ) . then ( ( ) => {
251
- const result = NextStepUtils . buildNextStep ( report , CONST . REPORT . STATUS_NUM . OPEN ) ;
251
+ const result = buildNextStep ( report , CONST . REPORT . STATUS_NUM . OPEN ) ;
252
252
253
253
expect ( result ) . toMatchObject ( optimisticNextStep ) ;
254
254
} ) ;
@@ -284,7 +284,7 @@ describe('libs/NextStepUtils', () => {
284
284
enabled : true ,
285
285
} ,
286
286
} ) . then ( ( ) => {
287
- const result = NextStepUtils . buildNextStep ( report , CONST . REPORT . STATUS_NUM . OPEN ) ;
287
+ const result = buildNextStep ( report , CONST . REPORT . STATUS_NUM . OPEN ) ;
288
288
289
289
expect ( result ) . toMatchObject ( optimisticNextStep ) ;
290
290
} ) ;
@@ -322,7 +322,7 @@ describe('libs/NextStepUtils', () => {
322
322
enabled : true ,
323
323
} ,
324
324
} ) . then ( ( ) => {
325
- const result = NextStepUtils . buildNextStep ( report , CONST . REPORT . STATUS_NUM . OPEN ) ;
325
+ const result = buildNextStep ( report , CONST . REPORT . STATUS_NUM . OPEN ) ;
326
326
327
327
expect ( result ) . toMatchObject ( optimisticNextStep ) ;
328
328
} ) ;
@@ -357,14 +357,14 @@ describe('libs/NextStepUtils', () => {
357
357
enabled : true ,
358
358
} ,
359
359
} ) . then ( ( ) => {
360
- const result = NextStepUtils . buildNextStep ( report , CONST . REPORT . STATUS_NUM . OPEN ) ;
360
+ const result = buildNextStep ( report , CONST . REPORT . STATUS_NUM . OPEN ) ;
361
361
362
362
expect ( result ) . toMatchObject ( optimisticNextStep ) ;
363
363
} ) ;
364
364
} ) ;
365
365
366
366
test ( 'manual' , ( ) => {
367
- // Waiting for userSubmitter to add expense(s).
367
+ // Waiting for userSubmitter to submit expense(s).
368
368
optimisticNextStep . message = [
369
369
{
370
370
text : 'Waiting for ' ,
@@ -377,7 +377,7 @@ describe('libs/NextStepUtils', () => {
377
377
text : ' to ' ,
378
378
} ,
379
379
{
380
- text : 'add ' ,
380
+ text : 'submit ' ,
381
381
} ,
382
382
{
383
383
text : ' %expenses.' ,
@@ -390,7 +390,7 @@ describe('libs/NextStepUtils', () => {
390
390
enabled : false ,
391
391
} ,
392
392
} ) . then ( ( ) => {
393
- const result = NextStepUtils . buildNextStep ( report , CONST . REPORT . STATUS_NUM . OPEN ) ;
393
+ const result = buildNextStep ( report , CONST . REPORT . STATUS_NUM . OPEN ) ;
394
394
395
395
expect ( result ) . toMatchObject ( optimisticNextStep ) ;
396
396
} ) ;
@@ -421,7 +421,7 @@ describe('libs/NextStepUtils', () => {
421
421
} ,
422
422
] ;
423
423
424
- const result = NextStepUtils . buildNextStep ( report , CONST . REPORT . STATUS_NUM . APPROVED ) ;
424
+ const result = buildNextStep ( report , CONST . REPORT . STATUS_NUM . APPROVED ) ;
425
425
426
426
expect ( result ) . toMatchObject ( optimisticNextStep ) ;
427
427
} ) ;
@@ -453,7 +453,7 @@ describe('libs/NextStepUtils', () => {
453
453
accountNumber : '123456789' ,
454
454
} ,
455
455
} ) . then ( ( ) => {
456
- const result = NextStepUtils . buildNextStep ( report , CONST . REPORT . STATUS_NUM . APPROVED ) ;
456
+ const result = buildNextStep ( report , CONST . REPORT . STATUS_NUM . APPROVED ) ;
457
457
458
458
expect ( result ) . toMatchObject ( optimisticNextStep ) ;
459
459
@@ -495,7 +495,7 @@ describe('libs/NextStepUtils', () => {
495
495
} ,
496
496
} ,
497
497
} ) . then ( ( ) => {
498
- const result = NextStepUtils . buildNextStep ( report , CONST . REPORT . STATUS_NUM . SUBMITTED ) ;
498
+ const result = buildNextStep ( report , CONST . REPORT . STATUS_NUM . SUBMITTED ) ;
499
499
500
500
expect ( result ) . toMatchObject ( optimisticNextStep ) ;
501
501
} ) ;
@@ -532,7 +532,7 @@ describe('libs/NextStepUtils', () => {
532
532
} ,
533
533
} ,
534
534
} ) . then ( ( ) => {
535
- const result = NextStepUtils . buildNextStep ( report , CONST . REPORT . STATUS_NUM . SUBMITTED ) ;
535
+ const result = buildNextStep ( report , CONST . REPORT . STATUS_NUM . SUBMITTED ) ;
536
536
537
537
expect ( result ) . toMatchObject ( optimisticNextStep ) ;
538
538
} ) ;
@@ -549,7 +549,7 @@ describe('libs/NextStepUtils', () => {
549
549
return Onyx . merge ( `${ ONYXKEYS . COLLECTION . POLICY } ${ policyID } ` , {
550
550
approvalMode : CONST . POLICY . APPROVAL_MODE . OPTIONAL ,
551
551
} ) . then ( ( ) => {
552
- const result = NextStepUtils . buildNextStep ( report , CONST . REPORT . STATUS_NUM . CLOSED ) ;
552
+ const result = buildNextStep ( report , CONST . REPORT . STATUS_NUM . CLOSED ) ;
553
553
554
554
expect ( result ) . toMatchObject ( optimisticNextStep ) ;
555
555
} ) ;
@@ -566,7 +566,7 @@ describe('libs/NextStepUtils', () => {
566
566
} ,
567
567
] ;
568
568
569
- const result = NextStepUtils . buildNextStep ( report , CONST . REPORT . STATUS_NUM . APPROVED ) ;
569
+ const result = buildNextStep ( report , CONST . REPORT . STATUS_NUM . APPROVED ) ;
570
570
571
571
expect ( result ) . toMatchObject ( optimisticNextStep ) ;
572
572
} ) ;
@@ -597,7 +597,7 @@ describe('libs/NextStepUtils', () => {
597
597
report . stateNum = CONST . REPORT . STATE_NUM . APPROVED ;
598
598
report . statusNum = CONST . REPORT . STATUS_NUM . APPROVED ;
599
599
600
- const result = NextStepUtils . buildNextStep ( report , CONST . REPORT . STATUS_NUM . APPROVED ) ;
600
+ const result = buildNextStep ( report , CONST . REPORT . STATUS_NUM . APPROVED ) ;
601
601
602
602
expect ( result ) . toMatchObject ( optimisticNextStep ) ;
603
603
@@ -633,7 +633,7 @@ describe('libs/NextStepUtils', () => {
633
633
accountNumber : '123456789' ,
634
634
} ,
635
635
} ) . then ( ( ) => {
636
- const result = NextStepUtils . buildNextStep ( report , CONST . REPORT . STATUS_NUM . APPROVED ) ;
636
+ const result = buildNextStep ( report , CONST . REPORT . STATUS_NUM . APPROVED ) ;
637
637
638
638
expect ( result ) . toMatchObject ( optimisticNextStep ) ;
639
639
} ) ;
@@ -648,7 +648,7 @@ describe('libs/NextStepUtils', () => {
648
648
} ,
649
649
] ;
650
650
651
- const result = NextStepUtils . buildNextStep ( report , CONST . REPORT . STATUS_NUM . REIMBURSED ) ;
651
+ const result = buildNextStep ( report , CONST . REPORT . STATUS_NUM . REIMBURSED ) ;
652
652
653
653
expect ( result ) . toMatchObject ( optimisticNextStep ) ;
654
654
} ) ;
0 commit comments