Skip to content

Commit 6dda4c6

Browse files
committed
test: fix block and wallet tests following the main rebase
1 parent 394f83f commit 6dda4c6

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

test/unit/modules/blocks.test.ts

+10-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
import { hashBlock, signBlock } from 'nanocurrency';
22
import { Blocks } from '../../../lib/modules/blocks/blocks';
3-
import { CreateBlockParams, SignedBlock } from '../../../lib/modules/blocks/blocks-interface';
3+
import { CreateBlockParams } from '../../../lib/modules/blocks/blocks-interface';
44
import { Block, BlockInfo } from '../../../lib/modules/blocks/blocks-schema';
55
import { Rpc } from '../../../lib/services/rpc/rpc';
6-
import { randomNanoAddresses } from '../../utils/utils';
76

8-
jest.mock('nanocurrency');
7+
jest.mock('nanocurrency', () => ({
8+
...jest.requireActual('nanocurrency'),
9+
hashBlock: jest.fn(),
10+
signBlock: jest.fn(),
11+
}));
912

1013
// TODO: separate all mthods tests in describe blocks
1114
describe('Blocks', () => {
@@ -94,7 +97,7 @@ describe('Blocks', () => {
9497
it('should call block_info RPC method with the provided hash and parse the result', async () => {
9598
const hash = 'blockHash';
9699
const infoResponse = {
97-
block_account: 'block_account',
100+
block_account: 'nano_1t7qkq38d8imy6hoin48ywxpokorxoh8kqz4zntxk6c4qkpsznhitda4a5wo',
98101
amount: 'amount',
99102
balance: 'balance',
100103
height: 'height',
@@ -103,12 +106,12 @@ describe('Blocks', () => {
103106
confirmed: 'confirmed',
104107
contents: {
105108
type: 'type',
106-
account: 'account',
109+
account: 'nano_1t7qkq38d8imy6hoin48ywxpokorxoh8kqz4zntxk6c4qkpsznhitda4a5wo',
107110
previous: 'previous',
108-
representative: 'representative',
111+
representative: 'nano_1tx1oxyczf9mczjnw8k8fktydjekry57aeet8f9cyxtpg9uf56owy4iup6ad',
109112
balance: 'balance',
110113
link: 'link',
111-
link_as_account: 'link_as_account',
114+
link_as_account: 'nano_3barjiyag1agq4akumc4hstgmjiqd5mhi81y5enkwh95srs76q4fy1j8u4ie',
112115
signature: 'signature',
113116
work: 'work',
114117
},

test/unit/modules/wallet.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ describe('Wallet class', () => {
6060

6161
const result = await wallet.open(representative);
6262
expect(wallet.receivable).toHaveBeenCalledWith({ count: 1, sort: true });
63-
expect(workMock.generate).toHaveBeenCalledWith('publicKey');
63+
expect(workMock.generate).toHaveBeenCalledWith(publicKeyMock);
6464
expect(blocksMock.create).toHaveBeenCalledWith({
6565
previous: '0',
6666
representative: representative,

0 commit comments

Comments
 (0)