* Introduce framework for running basic tests for entities * Add pipeline tests to CircleCI config * Make pipeline tests more configurable and fix CircleCI config * Add coverage dir to pipeline package * Add basic tests for all exchange event entities * Add tests for remaining entities * Create separate test scripts in package.json and add new info to README * Update db_setup.ts to revert migrations even if you are using docker * Automatically pull the postgres image if needed * Add comment about why NumberToBigIntTransformer is needed
39 lines
1.2 KiB
TypeScript
39 lines
1.2 KiB
TypeScript
import 'mocha';
|
|
import 'reflect-metadata';
|
|
|
|
import { TokenMetadata } from '../../src/entities';
|
|
import { createDbConnectionOnceAsync } from '../db_setup';
|
|
import { chaiSetup } from '../utils/chai_setup';
|
|
|
|
import { testSaveAndFindEntityAsync } from './util';
|
|
|
|
chaiSetup.configure();
|
|
|
|
const metadataWithoutNullFields = {
|
|
address: '0xe41d2489571d322189246dafa5ebde1f4699f498',
|
|
authority: 'https://website-api.0xproject.com/tokens',
|
|
decimals: 18,
|
|
symbol: 'ZRX',
|
|
name: '0x',
|
|
};
|
|
|
|
const metadataWithNullFields = {
|
|
address: '0xe41d2489571d322189246dafa5ebde1f4699f499',
|
|
authority: 'https://website-api.0xproject.com/tokens',
|
|
decimals: null,
|
|
symbol: null,
|
|
name: null,
|
|
};
|
|
|
|
// tslint:disable:custom-no-magic-numbers
|
|
describe('TokenMetadata entity', () => {
|
|
it('save/find', async () => {
|
|
const connection = await createDbConnectionOnceAsync();
|
|
const tokenMetadata = [metadataWithoutNullFields, metadataWithNullFields];
|
|
const tokenMetadataRepository = connection.getRepository(TokenMetadata);
|
|
for (const tokenMetadatum of tokenMetadata) {
|
|
await testSaveAndFindEntityAsync(tokenMetadataRepository, tokenMetadatum);
|
|
}
|
|
});
|
|
});
|