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

Commit

Permalink
Added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinP122 committed Oct 24, 2023
1 parent 644d4ca commit dd0ce5b
Showing 1 changed file with 43 additions and 1 deletion.
44 changes: 43 additions & 1 deletion src/tests/__tests__/ablock.service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,48 @@ beforeEach(() => {
ablockInstance = new ABlockWallet();
});

test('init wallet without optional config fields', async () => {

const config = {
mempoolHost: 'http://49.12.234.10:3003',
passphrase: '',
};

await ablockInstance.initNew(config).then((res) => {
expect(res.status).toBe('success');
});

await ablockInstance.fetchTransactions([]).then((res) => {
expect(res.reason).toBe('Error: Storage host not initialized');
});

await ablockInstance.fetchPendingRbTransactions([], []).then((res) => {
expect(res.reason).toBe('Error: Intercom host not initialized');
});

await ablockInstance.getNotaryBurnAddress().then((res) => {
expect(res.reason).toBe('Error: Notary host not initialized');
});
});

test('init wallet locally and then connect', async () => {
await ablockInstance.initNew({ passphrase: '' }, true).then((res) => {
console.log(res)
expect(res.status).toBe('success');
});

const config = {
mempoolHost: 'http://49.12.234.10:3003',
storageHost: 'http://49.12.234.10:3001',
passphrase: '',
};

await ablockInstance.initNetwork(config).then((res) => {
console.log(res)
expect(res.status).toBe('success');
});
});

test('handles key-pair re-generation from wallet seed phrase', async () => {
const utxoAddressList = [
/* TEMP_ADDRESS_VERSION = 99999 */
Expand All @@ -20,7 +62,7 @@ test('handles key-pair re-generation from wallet seed phrase', async () => {
'28a7de5c30f8271be690db7a979e1be33d31f6b6aebaa3c82888354ba214c24d',
];

await ablockInstance.fromSeed(SEED, { pass }, true,);
await ablockInstance.fromSeed(SEED, { passphrase: '' }, true,);

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

Expand Down

0 comments on commit dd0ce5b

Please sign in to comment.