Skip to content
This repository was archived by the owner on Mar 20, 2024. It is now read-only.

Commit dd0ce5b

Browse files
committed
Added tests
1 parent 644d4ca commit dd0ce5b

File tree

1 file changed

+43
-1
lines changed

1 file changed

+43
-1
lines changed

src/tests/__tests__/ablock.service.test.ts

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,48 @@ beforeEach(() => {
77
ablockInstance = new ABlockWallet();
88
});
99

10+
test('init wallet without optional config fields', async () => {
11+
12+
const config = {
13+
mempoolHost: 'http://49.12.234.10:3003',
14+
passphrase: '',
15+
};
16+
17+
await ablockInstance.initNew(config).then((res) => {
18+
expect(res.status).toBe('success');
19+
});
20+
21+
await ablockInstance.fetchTransactions([]).then((res) => {
22+
expect(res.reason).toBe('Error: Storage host not initialized');
23+
});
24+
25+
await ablockInstance.fetchPendingRbTransactions([], []).then((res) => {
26+
expect(res.reason).toBe('Error: Intercom host not initialized');
27+
});
28+
29+
await ablockInstance.getNotaryBurnAddress().then((res) => {
30+
expect(res.reason).toBe('Error: Notary host not initialized');
31+
});
32+
});
33+
34+
test('init wallet locally and then connect', async () => {
35+
await ablockInstance.initNew({ passphrase: '' }, true).then((res) => {
36+
console.log(res)
37+
expect(res.status).toBe('success');
38+
});
39+
40+
const config = {
41+
mempoolHost: 'http://49.12.234.10:3003',
42+
storageHost: 'http://49.12.234.10:3001',
43+
passphrase: '',
44+
};
45+
46+
await ablockInstance.initNetwork(config).then((res) => {
47+
console.log(res)
48+
expect(res.status).toBe('success');
49+
});
50+
});
51+
1052
test('handles key-pair re-generation from wallet seed phrase', async () => {
1153
const utxoAddressList = [
1254
/* TEMP_ADDRESS_VERSION = 99999 */
@@ -20,7 +62,7 @@ test('handles key-pair re-generation from wallet seed phrase', async () => {
2062
'28a7de5c30f8271be690db7a979e1be33d31f6b6aebaa3c82888354ba214c24d',
2163
];
2264

23-
await ablockInstance.fromSeed(SEED, { pass }, true,);
65+
await ablockInstance.fromSeed(SEED, { passphrase: '' }, true,);
2466

2567
const foundAddresses = await ablockInstance.regenAddresses(SEED, utxoAddressList, 6);
2668

0 commit comments

Comments
 (0)