39 lines
936 B
TypeScript
39 lines
936 B
TypeScript
import { expect, expectAsync, tap } from '@pushrocks/tapbundle';
|
|
import * as smartclickhouse from '../ts/index.js';
|
|
|
|
let testClickhouseDb: smartclickhouse.SmartClickHouseDb;
|
|
|
|
tap.test('first test', async () => {
|
|
testClickhouseDb = new smartclickhouse.SmartClickHouseDb({
|
|
host: 'localhost',
|
|
database: 'test2',
|
|
port: 8123,
|
|
protocol: 'http',
|
|
});
|
|
});
|
|
|
|
tap.test('should start the clickhouse db', async () => {
|
|
await testClickhouseDb.start(true);
|
|
});
|
|
|
|
tap.test('should create a timedatatable', async () => {
|
|
const table = await testClickhouseDb.getTable('analytics');
|
|
let i = 0;
|
|
while(i < 10) {
|
|
await table.addData({
|
|
timestamp: Date.now(),
|
|
message: `hello this is a message ${i}`,
|
|
wow: 'hey',
|
|
deep: {
|
|
so: 'hello',
|
|
myArray: ['array1', 'array2']
|
|
}
|
|
});
|
|
i++;
|
|
}
|
|
});
|
|
|
|
tap.skip.test('should write something to the clickhouse db', async () => {});
|
|
|
|
tap.start();
|