aboutsummaryrefslogtreecommitdiffstats
path: root/packages/pipeline/test/entities/token_order_test.ts
blob: c6057f5aae0b8e46227eb06182f534d4e299a6bb (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
import { BigNumber } from '@0x/utils';
import 'mocha';

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

import { testSaveAndFindEntityAsync } from './util';

chaiSetup.configure();

const tokenOrderbookSnapshot: TokenOrderbookSnapshot = {
    source: 'ddextest',
    observedTimestamp: Date.now(),
    orderType: 'bid',
    price: new BigNumber(10.1),
    baseAssetSymbol: 'ETH',
    baseAssetAddress: '0x818e6fecd516ecc3849daf6845e3ec868087b755',
    baseVolume: new BigNumber(143),
    quoteAssetSymbol: 'ABC',
    quoteAssetAddress: '0x00923b9a074762b93650716333b3e1473a15048e',
    quoteVolume: new BigNumber(12.3234234),
};

describe('TokenOrderbookSnapshot entity', () => {
    it('save/find', async () => {
        const connection = await createDbConnectionOnceAsync();
        const tokenOrderbookSnapshotRepository = connection.getRepository(TokenOrderbookSnapshot);
        await testSaveAndFindEntityAsync(tokenOrderbookSnapshotRepository, tokenOrderbookSnapshot);
    });
});