smartclickhouse/test/test.ts

37 lines
990 B
TypeScript
Raw Permalink Normal View History

2022-03-01 14:03:55 +00:00
import { expect, expectAsync, tap } from '@pushrocks/tapbundle';
import * as smartclickhouse from '../ts/index';
2022-03-02 15:35:20 +00:00
let testClickhouseDb: smartclickhouse.SmartClickHouseDb;
2022-03-01 14:03:55 +00:00
tap.test('first test', async () => {
2022-03-02 15:35:20 +00:00
testClickhouseDb = new smartclickhouse.SmartClickHouseDb({
host: 'localhost',
database: 'test2'
2022-03-01 14:03:55 +00:00
});
});
tap.test('should start the clickhouse db', async () => {
await testClickhouseDb.start();
})
2022-03-02 15:35:20 +00:00
tap.skip.test('should write something to the clickhouse db', async () => {
const result2 = await testClickhouseDb.clickhouseClient.queryPromise(`CREATE TABLE IF NOT EXISTS visits2 (
2022-03-01 14:03:55 +00:00
timestamp UInt64,
ip String,
os String,
userAgent String,
version String
2022-03-02 15:35:20 +00:00
) 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'
}
]);
2022-03-01 14:03:55 +00:00
})
tap.start();