smartclickhouse/test/test.ts

31 lines
859 B
TypeScript
Raw Normal View History

2022-03-01 14:03:55 +00:00
import { expect, expectAsync, tap } from '@pushrocks/tapbundle';
import * as smartclickhouse from '../ts/index';
let testClickhouseDb: smartclickhouse.ClickhouseDb;
tap.test('first test', async () => {
testClickhouseDb = new smartclickhouse.ClickhouseDb({
url: 'http://localhost',
port: 8123,
});
});
tap.test('should start the clickhouse db', async () => {
await testClickhouseDb.start();
})
tap.test('should write something to the clickhouse db', async () => {
const result = await testClickhouseDb.clickhouseClient.query(`CREATE DATABASE IF NOT EXISTS lossless`);
console.log(result);
const result2 = await testClickhouseDb.clickhouseClient.query(`CREATE TABLE IF NOT EXISTS lossless.visits (
timestamp UInt64,
ip String,
os String,
userAgent String,
version String
)`);
console.log(result);
})
tap.start();