-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsymbol.test.js
38 lines (34 loc) · 863 Bytes
/
symbol.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
const { symbol, nameToUint64 } = require('../dist');
describe('test symbol name', () => {
it('EOS symbol', () => {
/**
* cleos -u https://eos.greymass.com get scope eosio.token -t stat
*/
const name = '........ehbo5';
const uint64 = nameToUint64(name);
expect(symbol.toName(uint64)).toEqual('EOS');
});
it('parse symbol name', () => {
/**
* cleos -u https://api.canfoundation.io get scope canpasstoken -t stat
*/
const data = [
{
scope: '.11oen2oeh2p4',
},
{
scope: '.1b5glegch2og',
},
{
scope: '.1f4en23cpa54',
},
];
const rs = ['TESTLEC', 'LECLEVN', 'TLECLEV'];
data
.map(({ scope }) => nameToUint64(scope))
.map((n) => symbol.toName(n))
.forEach((sym, i) => {
expect(sym).toEqual(rs[i]);
});
});
});