@@ -14,46 +14,41 @@ describe("common", () => {
1414 ) ,
1515 } ,
1616 } as unknown as TransactionIntent < MemoNotSupported , BufferTxData > ;
17+ const expectedResult = Buffer . from ( intent . data . value ) ;
1718
1819 const result = getCallData ( intent ) ;
19- expect ( result ) . toEqual ( intent . data . value ) ;
20+ expect ( result ) . toEqual ( expectedResult ) ;
2021 } ) ;
2122
22- it ( "should return empty buffer for native asset" , ( ) => {
23- const intent = {
23+ it . each ( [
24+ {
2425 asset : {
2526 type : "native" ,
2627 } ,
27- } as unknown as TransactionIntent < MemoNotSupported , BufferTxData > ;
28-
29- const result = getCallData ( intent ) ;
30- expect ( result ) . toEqual ( Buffer . from ( [ ] ) ) ;
31- } ) ;
32-
33- it ( "should return empty buffer for non native asset and no recipient" , ( ) => {
34- const intent = {
28+ } as unknown as TransactionIntent < MemoNotSupported , BufferTxData > ,
29+ {
3530 asset : {
3631 type : "erc20" ,
3732 } ,
38- } as unknown as TransactionIntent < MemoNotSupported , BufferTxData > ;
39-
40- const result = getCallData ( intent ) ;
41- expect ( result ) . toEqual ( Buffer . from ( [ ] ) ) ;
42- } ) ;
43-
44- it ( "should return empty buffer for non native asset with recipient and no amount" , ( ) => {
45- const intent = {
33+ } as unknown as TransactionIntent < MemoNotSupported , BufferTxData > ,
34+ {
4635 asset : {
4736 type : "erc20" ,
4837 } ,
4938 recipient : "0x66c4371aE8FFeD2ec1c2EBbbcCfb7E494181E1E3" ,
50- } as unknown as TransactionIntent < MemoNotSupported , BufferTxData > ;
51-
39+ } as unknown as TransactionIntent < MemoNotSupported , BufferTxData > ,
40+ {
41+ asset : {
42+ type : "erc20" ,
43+ } ,
44+ amount : 1n ,
45+ } as unknown as TransactionIntent < MemoNotSupported , BufferTxData > ,
46+ ] ) ( "should return empty buffer for invalid intent" , intent => {
5247 const result = getCallData ( intent ) ;
5348 expect ( result ) . toEqual ( Buffer . from ( [ ] ) ) ;
5449 } ) ;
5550
56- it ( "should return calldata from contract for non native asset with a recipient" , ( ) => {
51+ it ( "should return calldata from contract for non native asset with a recipient and an amount " , ( ) => {
5752 const intent = {
5853 asset : {
5954 type : "erc20" ,
0 commit comments