From a3dbaeaaf96a1978a41acf71db1a6cec54c65a9c Mon Sep 17 00:00:00 2001 From: rinsuki <428rinsuki+git@gmail.com> Date: Fri, 25 Oct 2019 07:41:04 +0900 Subject: [PATCH] maybe fix --- test/chart.ts | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/test/chart.ts b/test/chart.ts index bd26f3bf36..c0d6710799 100644 --- a/test/chart.ts +++ b/test/chart.ts @@ -18,35 +18,13 @@ import * as assert from 'assert'; import * as lolex from 'lolex'; import { async } from './utils'; import { getConnection, createConnection } from 'typeorm'; +import { initDb } from '../src/db/postgre'; const config = require('../built/config').default; const Chart = require('../built/services/chart/core').default; const _TestChart = require('../built/services/chart/charts/schemas/test'); const _TestGroupedChart = require('../built/services/chart/charts/schemas/test-grouped'); const _TestUniqueChart = require('../built/services/chart/charts/schemas/test-unique'); -function initDb() { - try { - const conn = getConnection(); - return Promise.resolve(conn); - } catch (e) {} - - return createConnection({ - type: 'postgres', - host: config.db.host, - port: config.db.port, - username: config.db.user, - password: config.db.pass, - database: config.db.db, - synchronize: true, - dropSchema: true, - entities: [ - Chart.schemaToEntity(_TestChart.name, _TestChart.schema), - Chart.schemaToEntity(_TestGroupedChart.name, _TestGroupedChart.schema), - Chart.schemaToEntity(_TestUniqueChart.name, _TestUniqueChart.schema) - ] - }); -} - describe('Chart', () => { let testChart: any; let testGroupedChart: any;