smartclickhouse/test/test.ts
2022-03-02 16:35:20 +01:00

37 lines
990 B
TypeScript

import { expect, expectAsync, tap } from '@pushrocks/tapbundle';
import * as smartclickhouse from '../ts/index';
let testClickhouseDb: smartclickhouse.SmartClickHouseDb;
tap.test('first test', async () => {
testClickhouseDb = new smartclickhouse.SmartClickHouseDb({
host: 'localhost',
database: 'test2'
});
});
tap.test('should start the clickhouse db', async () => {
await testClickhouseDb.start();
})
tap.skip.test('should write something to the clickhouse db', async () => {
const result2 = await testClickhouseDb.clickhouseClient.queryPromise(`CREATE TABLE IF NOT EXISTS visits2 (
timestamp UInt64,
ip String,
os String,
userAgent String,
version String
) ENGINE=MergeTree() ORDER BY timestamp`);
const result3 = await testClickhouseDb.clickhouseClient.insertPromise('visits2', [
{
timestamp: Date.now(),
ip: '127.0.01',
os: 'Mac OS X',
userAgent: 'some',
version: 'someversion'
}
]);
})
tap.start();