@@ -303,6 +303,28 @@ describe('ReportUtils', () => {
303303 const randomReportAction = createRandomReportAction ( reportActionID ) ;
304304 const policyID = '2424' ;
305305 const amount = 39 ;
306+
307+ /* CREATE an outstanding EXPENSE REPORT
308+ type = expense
309+ TODO: stateNum and statusNum can be less than or equal to CONST.REPORT.STATE_NUM.SUBMITTED
310+
311+ */
312+
313+ /* CREATE policy
314+ moneyRequestReport?.policyID = policy.id
315+ */
316+ const policy1 = { ...createRandomPolicy ( Number ( policyID ) , CONST . POLICY . TYPE . TEAM ) , areInvoicesEnabled : true , role : CONST . POLICY . ROLE . ADMIN } ;
317+
318+ // Given that there is atleast one outstanding expense report in a policy
319+ const outstandingExpenseReport = {
320+ ...createExpenseReport ( 483 ) ,
321+ policyID,
322+ stateNum : CONST . REPORT . STATE_NUM . OPEN ,
323+ statusNum : CONST . REPORT . STATUS_NUM . OPEN ,
324+ ownerAccountID : currentUserAccountID ,
325+ } ;
326+
327+ // When a user creates an invoice in the same policy
306328 const reportAction = {
307329 ...randomReportAction ,
308330 actionName : CONST . REPORT . ACTIONS . TYPE . IOU ,
@@ -345,25 +367,6 @@ describe('ReportUtils', () => {
345367 managerID : 8723 ,
346368 } ;
347369
348- /* CREATE policy
349- moneyRequestReport?.policyID = policy.id
350- */
351- const policyC = { ...createRandomPolicy ( Number ( policyID ) , CONST . POLICY . TYPE . TEAM ) , areInvoicesEnabled : true , role : CONST . POLICY . ROLE . ADMIN } ;
352-
353- /* CREATE an outstanding EXPENSE REPORT
354- type = expense
355- TODO: stateNum and statusNum can be less than or equal to CONST.REPORT.STATE_NUM.SUBMITTED
356-
357- */
358-
359- const outstandingExpenseReport = {
360- ...createExpenseReport ( 483 ) ,
361- policyID,
362- stateNum : CONST . REPORT . STATE_NUM . OPEN ,
363- statusNum : CONST . REPORT . STATUS_NUM . OPEN ,
364- ownerAccountID : currentUserAccountID ,
365- } ;
366-
367370 /* might not need to add this
368371 add the report action with
369372 hasForwardedAction
@@ -377,11 +380,12 @@ describe('ReportUtils', () => {
377380 Onyx . merge ( `${ ONYXKEYS . COLLECTION . TRANSACTION } ${ IOUTransactionID } ` , moneyRequestTransaction ) ;
378381 Onyx . merge ( `${ ONYXKEYS . COLLECTION . REPORT } ${ IOUReportID } ` , invoiceReport ) ;
379382 Onyx . merge ( `${ ONYXKEYS . COLLECTION . REPORT } ${ 483 } ` , outstandingExpenseReport ) ;
380- Onyx . merge ( `${ ONYXKEYS . COLLECTION . POLICY } ${ policyID } ` , policyC ) ;
383+ Onyx . merge ( `${ ONYXKEYS . COLLECTION . POLICY } ${ policyID } ` , policy1 ) ;
381384 return waitForBatchedUpdates ( ) ;
382385 } ) ;
383386
384- it ( 'test' , ( ) => {
387+ // Then the user should be able to move the invoice to the outstadning expense report
388+ it ( 'should return true for invoice report action given that there is a minimum of one oustanding report' , ( ) => {
385389 const canEditReportField = canEditFieldOfMoneyRequest ( reportAction , CONST . EDIT_REQUEST_FIELD . REPORT ) ;
386390 expect ( canEditReportField ) . toBe ( true ) ;
387391 } ) ;
0 commit comments