fix(core): update
This commit is contained in:
35
test/test.nonci.ts
Normal file
35
test/test.nonci.ts
Normal file
@ -0,0 +1,35 @@
|
||||
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(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'
|
||||
}
|
||||
});
|
||||
i++;
|
||||
}
|
||||
});
|
||||
|
||||
tap.skip.test('should write something to the clickhouse db', async () => {});
|
||||
|
||||
tap.start();
|
40
test/test.ts
40
test/test.ts
@ -1,40 +0,0 @@
|
||||
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.test('should create a timedatatable', async () => {
|
||||
testClickhouseDb.getTable('analytics')
|
||||
})
|
||||
|
||||
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();
|
Reference in New Issue
Block a user