|
1 | 1 | import sinon from 'sinon'; |
2 | 2 | import assert from 'assert'; |
3 | 3 | import _ from 'lodash'; |
| 4 | +import should from 'should'; |
4 | 5 | import { BitGoAPI } from '@bitgo/sdk-api'; |
5 | 6 | import { TestBitGo, TestBitGoAPI } from '@bitgo/sdk-test'; |
6 | 7 | import { coins, GasTankAccountCoin } from '@bitgo/statics'; |
@@ -109,6 +110,39 @@ describe('Vechain', function () { |
109 | 110 | }) |
110 | 111 | .should.rejectedWith('missing required tx prebuild property txHex'); |
111 | 112 | }); |
| 113 | + |
| 114 | + it('should build correct nft transfer data', function () { |
| 115 | + const data = basecoin.buildNftTransferData({ |
| 116 | + fromAddress: testData.addresses.validAddresses[0], |
| 117 | + recipientAddress: testData.addresses.validAddresses[1], |
| 118 | + type: 'ERC721', |
| 119 | + tokenId: '1234', |
| 120 | + tokenContractAddress: testData.NFT_CONTRACT_ADDRESS, |
| 121 | + }); |
| 122 | + data.should.equal(testData.VALID_NFT_CONTRACT_DATA); |
| 123 | + }); |
| 124 | + |
| 125 | + it('should build throw invalid address error', function () { |
| 126 | + should(() => |
| 127 | + basecoin.buildNftTransferData({ |
| 128 | + fromAddress: testData.addresses.validAddresses[0], |
| 129 | + recipientAddress: testData.addresses.invalidAddresses[0], |
| 130 | + type: 'ERC721', |
| 131 | + tokenId: '1234', |
| 132 | + tokenContractAddress: testData.NFT_CONTRACT_ADDRESS, |
| 133 | + }) |
| 134 | + ).throwError('Invalid recipient address'); |
| 135 | + |
| 136 | + should(() => |
| 137 | + basecoin.buildNftTransferData({ |
| 138 | + fromAddress: testData.addresses.invalidAddresses[0], |
| 139 | + recipientAddress: testData.addresses.validAddresses[0], |
| 140 | + type: 'ERC721', |
| 141 | + tokenId: '1234', |
| 142 | + tokenContractAddress: testData.NFT_CONTRACT_ADDRESS, |
| 143 | + }) |
| 144 | + ).throwError('Invalid from address'); |
| 145 | + }); |
112 | 146 | }); |
113 | 147 |
|
114 | 148 | describe('Parse and Explain Transactions: ', () => { |
|
0 commit comments