@@ -83,7 +83,7 @@ describe('getViolationsOnyxData', () => {
83
83
comment :
{ attendees :
[ { email :
'[email protected] ' , displayName :
'Test User' , avatarUrl :
'' } ] } ,
84
84
created : '2023-07-24 13:46:20' ,
85
85
merchant : 'United Airlines' ,
86
- currency : ' USD' ,
86
+ currency : CONST . CURRENCY . USD ,
87
87
} ;
88
88
transactionViolations = [ ] ;
89
89
policy = { requiresTag : false , requiresCategory : false } as Policy ;
@@ -155,6 +155,7 @@ describe('getViolationsOnyxData', () => {
155
155
describe ( 'controlPolicyViolations' , ( ) => {
156
156
beforeEach ( ( ) => {
157
157
policy . type = 'corporate' ;
158
+ policy . outputCurrency = CONST . CURRENCY . USD ;
158
159
} ) ;
159
160
160
161
it ( 'should not add futureDate violation if the policy is not corporate' , ( ) => {
@@ -185,12 +186,28 @@ describe('getViolationsOnyxData', () => {
185
186
expect ( result . value ) . toEqual ( expect . arrayContaining ( [ receiptRequiredViolation , ...transactionViolations ] ) ) ;
186
187
} ) ;
187
188
189
+ it ( 'should not add receiptRequired violation if the transaction has different currency than the workspace currency' , ( ) => {
190
+ transaction . amount = 1000000 ;
191
+ transaction . modifiedCurrency = CONST . CURRENCY . CAD ;
192
+ policy . maxExpenseAmountNoReceipt = 2500 ;
193
+ const result = ViolationsUtils . getViolationsOnyxData ( transaction , transactionViolations , policy , policyTags , policyCategories , false , false ) ;
194
+ expect ( result . value ) . toEqual ( [ ] ) ;
195
+ } ) ;
196
+
188
197
it ( 'should add overLimit violation if the transaction amount is over the policy limit' , ( ) => {
189
198
transaction . amount = 1000000 ;
190
199
policy . maxExpenseAmount = 200000 ;
191
200
const result = ViolationsUtils . getViolationsOnyxData ( transaction , transactionViolations , policy , policyTags , policyCategories , false , false ) ;
192
201
expect ( result . value ) . toEqual ( expect . arrayContaining ( [ overLimitViolation , ...transactionViolations ] ) ) ;
193
202
} ) ;
203
+
204
+ it ( 'should not add overLimit violation if the transaction currency is different from the workspace currency' , ( ) => {
205
+ transaction . amount = 1000000 ;
206
+ transaction . modifiedCurrency = CONST . CURRENCY . NZD ;
207
+ policy . maxExpenseAmount = 200000 ;
208
+ const result = ViolationsUtils . getViolationsOnyxData ( transaction , transactionViolations , policy , policyTags , policyCategories , false , false ) ;
209
+ expect ( result . value ) . toEqual ( [ ] ) ;
210
+ } ) ;
194
211
} ) ;
195
212
196
213
describe ( 'policyRequiresCategories' , ( ) => {
0 commit comments