@yoroi/portfolio
Version:
The Portfolio package of Yoroi SDK
57 lines (56 loc) • 1.96 kB
JavaScript
;
var _token = require("../adapters/token.mocks");
var _infoExtractName = require("./info-extract-name");
describe('infoExtractName', () => {
it('should extract the ticker from FT token', () => {
const result = (0, _infoExtractName.infoExtractName)(_token.tokenMocks.primaryETH.info, {
mode: 'name'
});
expect(result).toBe('ETH');
});
it('should extract the name from FT token when ticker is empty', () => {
const result = (0, _infoExtractName.infoExtractName)({
..._token.tokenMocks.primaryETH.info,
ticker: ''
}, {
mode: 'name'
});
expect(result).toBe('Ethereum');
});
it('should extract the fingerprint from FT token when ticker/name are empty', () => {
const result = (0, _infoExtractName.infoExtractName)({
..._token.tokenMocks.primaryETH.info,
ticker: '',
name: ''
}, {
mode: 'name'
});
expect(result).toBe('0x1234567890abcdef');
});
it('should extract the name from NFT token', () => {
const result = (0, _infoExtractName.infoExtractName)(_token.tokenMocks.nftCryptoKitty.info, {
mode: 'name'
});
expect(result).toBe('CryptoKitty #1234');
});
it('should extract the fingerprint from NFT token when name is empty', () => {
const result = (0, _infoExtractName.infoExtractName)({
..._token.tokenMocks.nftCryptoKitty.info,
name: ''
}, {
mode: 'name'
});
expect(result).toBe('asset1s7nlt...eg483c6wu75');
});
it('should extract the ticker from token', () => {
const result = (0, _infoExtractName.infoExtractName)(_token.tokenMocks.rnftWhatever.info, {
mode: 'currency'
});
expect(result).toBe('Whatever');
});
it('should extract the ticker default', () => {
const result = (0, _infoExtractName.infoExtractName)(_token.tokenMocks.rnftWhatever.info);
expect(result).toBe('Whatever #42');
});
});
//# sourceMappingURL=info-extract-name.test.js.map