|
| 1 | +import { denomToAsset, denomToExponent, getIbcInfo } from '../utils'; |
| 2 | + |
| 3 | +describe('denomToAsset()', () => { |
| 4 | + it('should return OSMO', () => { |
| 5 | + const denom = |
| 6 | + 'ibc/ED07A3391A112B175915CD8FAF43A2DA8E4790EDE12566649D0C2F97716B8518'; |
| 7 | + const symbol = denomToAsset('juno', denom)?.symbol; |
| 8 | + expect(symbol).toBe('OSMO'); |
| 9 | + }); |
| 10 | + |
| 11 | + it('should return ATOM', () => { |
| 12 | + const denom = |
| 13 | + 'ibc/C4CFF46FD6DE35CA4CF4CE031E643C8FDC9BA4B99AE598E9B0ED98FE3A2319F9'; |
| 14 | + const symbol = denomToAsset('juno', denom)?.symbol; |
| 15 | + expect(symbol).toBe('ATOM'); |
| 16 | + }); |
| 17 | + |
| 18 | + it('should return JUNO', () => { |
| 19 | + const denom = 'ujuno'; |
| 20 | + const symbol = denomToAsset('juno', denom)?.symbol; |
| 21 | + expect(symbol).toBe('JUNO'); |
| 22 | + }); |
| 23 | + |
| 24 | + it('should return undefined', () => { |
| 25 | + const denom = 'ujuno'; |
| 26 | + const symbol = denomToAsset('osmosis', denom)?.symbol; |
| 27 | + expect(symbol).toBeUndefined(); |
| 28 | + }); |
| 29 | + |
| 30 | + it('should return ION', () => { |
| 31 | + const denom = 'uion'; |
| 32 | + const symbol = denomToAsset('osmosis', denom)?.symbol; |
| 33 | + expect(symbol).toBe('ION'); |
| 34 | + }); |
| 35 | +}); |
| 36 | + |
| 37 | +describe('denomToExponent()', () => { |
| 38 | + it('should return 6', () => { |
| 39 | + const denom = |
| 40 | + 'ibc/F6B367385300865F654E110976B838502504231705BAC0849B0651C226385885'; |
| 41 | + expect(denomToExponent('juno', denom)).toBe(6); |
| 42 | + }); |
| 43 | + |
| 44 | + it('should return 18', () => { |
| 45 | + const denom = |
| 46 | + 'ibc/7E4A6EEFA0425CF99DE169A586D9BADF39C40153194CD6784BF8C9F6123BF5D0'; |
| 47 | + expect(denomToExponent('juno', denom)).toBe(18); |
| 48 | + }); |
| 49 | + |
| 50 | + it('should return 6', () => { |
| 51 | + const denom = 'ujuno'; |
| 52 | + expect(denomToExponent('juno', denom)).toBe(6); |
| 53 | + }); |
| 54 | + |
| 55 | + it('should return 6', () => { |
| 56 | + const denom = 'uion'; |
| 57 | + expect(denomToExponent('osmosis', denom)).toBe(6); |
| 58 | + }); |
| 59 | +}); |
| 60 | + |
| 61 | +describe('getIbcInfo()', () => { |
| 62 | + it('should return channel-2', () => { |
| 63 | + expect(getIbcInfo('agoric', 'crescent').sourceChannel).toBe('channel-2'); |
| 64 | + }); |
| 65 | + |
| 66 | + it('should return channel-11', () => { |
| 67 | + expect(getIbcInfo('crescent', 'agoric').sourceChannel).toBe('channel-11'); |
| 68 | + }); |
| 69 | +}); |
0 commit comments