Skip to content
This repository was archived by the owner on May 26, 2023. It is now read-only.

Commit 92584ee

Browse files
author
Noel
authored
test: move test cases (#367)
1 parent c51566b commit 92584ee

File tree

10 files changed

+113
-680
lines changed

10 files changed

+113
-680
lines changed

packages/zilliqa-js-account/test/account.spec.ts

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
// You should have received a copy of the GNU General Public License
1616
// along with this program. If not, see <https://www.gnu.org/licenses/>.
1717

18-
import fs from 'fs';
1918
import Signature from 'elliptic/lib/elliptic/ec/signature';
2019
import { HTTPProvider } from '@zilliqa-js/core';
2120
import * as zcrypto from '@zilliqa-js/crypto';
@@ -48,17 +47,30 @@ describe('Account', () => {
4847
});
4948

5049
it('should create accounts from keystores', async () => {
51-
const content = await new Promise((resolve, reject) => {
52-
fs.readFile(
53-
`${__dirname}/fixtures/keystores_redux.json`,
54-
'utf8',
55-
(err, data) => {
56-
err ? reject(err) : resolve(data);
57-
},
58-
);
59-
});
50+
const keystoreFixtures = [
51+
{
52+
privateKey:
53+
'50af9e8c08011953f568d1818ad500a84b906117fb79502fc069525d1475d543',
54+
passphrase: 'strong_password',
55+
keystore:
56+
'{"address":"0x3591c6b333776a5b6c885Ada53b4462dEe8c67B6","crypto":{"cipher":"aes-128-ctr","cipherparams":{"iv":"1b23d4a09fa241b9cbe176fbc7d9567f"},"ciphertext":"40cce0a0b4eee4e4258341e18d880ff4b12ed25887252b90b7de4b6be86da5d5","kdf":"scrypt","kdfparams":{"salt":"4997f389a370424072967f6faeb709c238ff3cc3606a4101fc3dcbdd74b67108","n":8192,"c":262144,"r":8,"p":1,"dklen":32},"mac":"97f0677a9f0ad0c6052896e1b5ae94f86025047b9fe2617c1fce220af0db0e82"},"id":"39626239-3338-4138-b662-363663333030","version":3}',
57+
},
58+
{
59+
privateKey:
60+
'629fd0230abafb7bc8d575c604e6a1b3fabb2c995d5d6d0ab504156ce22d7136',
61+
passphrase: 'strong_password',
62+
keystore:
63+
'{"address":"0x8d991C6222F26B9aB960dbD28A1e9f29ED77272d","crypto":{"cipher":"aes-128-ctr","cipherparams":{"iv":"6177b7d2561056e9be3c991cce5148ce"},"ciphertext":"562c10f06d4fd050edcc4f99ef3390da34174c9d5a22ca46f4ed7d8ff0131e34","kdf":"scrypt","kdfparams":{"salt":"6c35d2b1918ff020bb52b4374105d9c5f9c20e586f2b4067818fe55ccc21372f","n":8192,"c":262144,"r":8,"p":1,"dklen":32},"mac":"b19578d520eac69a989e196fa65b059be8dd5644e157d065a17379f85d2a2994"},"id":"66373132-6463-4634-b936-356330326230","version":3}',
64+
},
65+
{
66+
privateKey:
67+
'c6525c60b970082edf830ea2ebdbe2437bdf715e0bf7e3fbb8d4b0e73ec029bc',
68+
passphrase: 'strong_password',
69+
keystore:
70+
'{"address":"0xF5D26831Be0B1fe5a6Ba5286DC59FaacE63f24aD","crypto":{"cipher":"aes-128-ctr","cipherparams":{"iv":"44d6acb359150e9019e1dda58da2ceca"},"ciphertext":"3e37afff8624b000591dd84745738c64c2728b94a74da60d8600fa9419381694","kdf":"scrypt","kdfparams":{"salt":"bbf3723986c6ce90f8fe7846d2bc0bef40885688bef01733158652019f7f6c22","n":8192,"c":262144,"r":8,"p":1,"dklen":32},"mac":"6d8f5522a520dba0e6820715a4ae62dbc6412ae6d25aa3d2eacd8941f7c427a9"},"id":"35313363-3863-4265-b135-366531343061","version":3}',
71+
},
72+
];
6073

61-
const keystoreFixtures = JSON.parse(content as string);
6274
for (const keystoreFixture of keystoreFixtures) {
6375
const { privateKey, passphrase, keystore } = keystoreFixture;
6476
const account = await Account.fromFile(keystore, passphrase);

packages/zilliqa-js-account/test/fixtures/gen-keystores.ts

Lines changed: 0 additions & 48 deletions
This file was deleted.

packages/zilliqa-js-account/test/fixtures/keystores.json

Lines changed: 0 additions & 264 deletions
This file was deleted.

0 commit comments

Comments
 (0)