solana/web3.js/test/account.test.ts
dependabot[bot] fda8cb176a
chore: bump prettier from 2.2.1 to 2.3.0 in /web3.js (#17143)
* chore: bump prettier from 2.2.1 to 2.3.0 in /web3.js

Bumps [prettier](https://github.com/prettier/prettier) from 2.2.1 to 2.3.0.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.2.1...2.3.0)

Signed-off-by: dependabot[bot] <support@github.com>

* chore: bump

* chore: format

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Justin Starry <justin@solana.com>
2021-05-25 03:53:16 +00:00

25 lines
818 B
TypeScript

import {expect} from 'chai';
import {Buffer} from 'buffer';
import {Account} from '../src/account';
describe('Account', () => {
it('generate new account', () => {
const account = new Account();
expect(account.secretKey).to.have.length(64);
});
it('account from secret key', () => {
const secretKey = Buffer.from([
153, 218, 149, 89, 225, 94, 145, 62, 233, 171, 46, 83, 227, 223, 173, 87,
93, 163, 59, 73, 190, 17, 37, 187, 146, 46, 51, 73, 79, 73, 136, 40, 27,
47, 73, 9, 110, 62, 93, 189, 15, 207, 169, 192, 192, 205, 146, 217, 171,
59, 33, 84, 75, 52, 213, 221, 74, 101, 217, 139, 135, 139, 153, 34,
]);
const account = new Account(secretKey);
expect(account.publicKey.toBase58()).to.eq(
'2q7pyhPwAwZ3QMfZrnAbDhnh9mDUqycszcpf86VgQxhF',
);
});
});