aboutsummaryrefslogtreecommitdiffstats
path: root/packages/pipeline/test/entities/relayer_test.ts
blob: 760ffb6f9989f926c2c0ada7f5244f1071222c41 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import 'mocha';
import * as R from 'ramda';
import 'reflect-metadata';

import { Relayer } from '../../src/entities';
import { createDbConnectionOnceAsync } from '../db_setup';
import { chaiSetup } from '../utils/chai_setup';

import { testSaveAndFindEntityAsync } from './util';

chaiSetup.configure();

const baseRelayer = {
    uuid: 'e8d27d8d-ddf6-48b1-9663-60b0a3ddc716',
    name: 'Radar Relay',
    homepageUrl: 'https://radarrelay.com',
    appUrl: null,
    sraHttpEndpoint: null,
    sraWsEndpoint: null,
    feeRecipientAddresses: [],
    takerAddresses: [],
};

const relayerWithUrls = R.merge(baseRelayer, {
    uuid: 'e8d27d8d-ddf6-48b1-9663-60b0a3ddc717',
    appUrl: 'https://app.radarrelay.com',
    sraHttpEndpoint: 'https://api.radarrelay.com/0x/v2/',
    sraWsEndpoint: 'wss://ws.radarrelay.com/0x/v2',
});

const relayerWithAddresses = R.merge(baseRelayer, {
    uuid: 'e8d27d8d-ddf6-48b1-9663-60b0a3ddc718',
    feeRecipientAddresses: [
        '0xa258b39954cef5cb142fd567a46cddb31a670124',
        '0xa258b39954cef5cb142fd567a46cddb31a670125',
        '0xa258b39954cef5cb142fd567a46cddb31a670126',
    ],
    takerAddresses: [
        '0xa258b39954cef5cb142fd567a46cddb31a670127',
        '0xa258b39954cef5cb142fd567a46cddb31a670128',
        '0xa258b39954cef5cb142fd567a46cddb31a670129',
    ],
});

// tslint:disable:custom-no-magic-numbers
describe('Relayer entity', () => {
    it('save/find', async () => {
        const connection = await createDbConnectionOnceAsync();
        const relayers = [baseRelayer, relayerWithUrls, relayerWithAddresses];
        const relayerRepository = connection.getRepository(Relayer);
        for (const relayer of relayers) {
            await testSaveAndFindEntityAsync(relayerRepository, relayer);
        }
    });
});