feat: wrap public key in a class

This commit is contained in:
Michael Vines
2018-09-30 18:42:45 -07:00
parent 2c3208090c
commit ca6965f8c2
15 changed files with 180 additions and 95 deletions

View File

@ -1,10 +1,10 @@
// @flow
import {Account} from '../src/account';
import {PublicKey} from '../src/publickey';
test('generate new account', () => {
const account = new Account();
expect(account.publicKey.length).toBeGreaterThanOrEqual(43);
expect(account.publicKey.length).toBeLessThanOrEqual(44);
expect(PublicKey.isPublicKey(account.publicKey)).toBeTruthy();
expect(account.secretKey).toHaveLength(64);
});
@ -17,5 +17,5 @@ test('account from secret key', () => {
74, 101, 217, 139, 135, 139, 153, 34
]);
const account = new Account(secretKey);
expect(account.publicKey).toBe('2q7pyhPwAwZ3QMfZrnAbDhnh9mDUqycszcpf86VgQxhF');
expect(account.publicKey.toBase58()).toBe('2q7pyhPwAwZ3QMfZrnAbDhnh9mDUqycszcpf86VgQxhF');
});