Skip to content

Commit 16d6a03

Browse files
committed
Converting PFS refucer tests to new pattern
1 parent 551225e commit 16d6a03

File tree

1 file changed

+20
-23
lines changed

1 file changed

+20
-23
lines changed

raiden-ts/tests/unit/epics/path.spec.ts

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
import {
2-
raidenEpicDeps,
32
makeLog,
43
makeRaidens,
54
makeRaiden,
65
providersEmit,
76
waitBlock,
87
sleep,
98
MockedRaiden,
10-
makeAddress,
119
fetch,
10+
makeAddress,
1211
} from '../mocks';
1312
import {
1413
token,
1514
tokenNetwork,
1615
amount,
1716
openBlock,
18-
epicFixtures,
1917
ensureChannelIsOpen,
2018
ensureChannelIsDeposited,
2119
deposit,
@@ -42,6 +40,21 @@ import { IOU } from 'raiden-ts/services/types';
4240

4341
const pfsAddress = makeAddress();
4442

43+
/**
44+
* @param raiden - Instance of MockedRaiden
45+
* @returns Mocked IOU type Object
46+
*/
47+
function makeIou(raiden: MockedRaiden): IOU {
48+
return {
49+
sender: raiden.address,
50+
receiver: pfsAddress,
51+
one_to_n_address: '0x0A0000000000000000000000000000000000000a' as Address,
52+
chain_id: bigNumberify(raiden.deps.network.chainId) as UInt<32>,
53+
expiration_block: bigNumberify(3232341) as UInt<32>,
54+
amount: bigNumberify(100) as UInt<32>,
55+
};
56+
}
57+
4558
describe('PFS: pathFindServiceEpic', () => {
4659
let raiden: MockedRaiden, partner: MockedRaiden, target: MockedRaiden;
4760
const pfsSafetyMargin = 2;
@@ -64,21 +77,6 @@ describe('PFS: pathFindServiceEpic', () => {
6477
};
6578
}
6679

67-
/**
68-
* @param raiden - Instance of MockedRaiden
69-
* @returns Mocked IOU type Object
70-
*/
71-
function makeIou(raiden: MockedRaiden): IOU {
72-
return {
73-
sender: raiden.address,
74-
receiver: pfsAddress,
75-
one_to_n_address: '0x0A0000000000000000000000000000000000000a' as Address,
76-
chain_id: bigNumberify(raiden.deps.network.chainId) as UInt<32>,
77-
expiration_block: bigNumberify(3232341) as UInt<32>,
78-
amount: bigNumberify(100) as UInt<32>,
79-
};
80-
}
81-
8280
beforeEach(async () => {
8381
[raiden, partner, target] = await makeRaidens(3);
8482

@@ -1258,13 +1256,12 @@ describe('PFS: reducer', () => {
12581256
test('persist and clear', async () => {
12591257
expect.assertions(2);
12601258

1261-
const depsMock = raidenEpicDeps();
1262-
const { iou, state, tokenNetwork } = epicFixtures(depsMock);
1263-
1259+
const raiden = await makeRaiden(undefined);
1260+
const iou = makeIou(raiden);
12641261
const newState = raidenReducer(
1265-
state,
1262+
raiden.store.getState(),
12661263
iouPersist(
1267-
{ iou: await signIOU(depsMock.signer, iou) },
1264+
{ iou: await signIOU(raiden.deps.signer, iou) },
12681265
{ tokenNetwork, serviceAddress: iou.receiver },
12691266
),
12701267
);

0 commit comments

Comments
 (0)