fix(test): fix test case for table deletion and optimize code

This commit is contained in:
2024-06-23 13:33:53 +02:00
parent 367bacb954
commit 84c355c499
5 changed files with 42 additions and 17 deletions

View File

@ -72,16 +72,6 @@ tap.test('should delete old entries', async (toolsArg) => {
await toolsArg.delayFor(5000);
});
tap.test('should delete the table', async () => {
await table.delete();
// Verify table deletion
const result = await testClickhouseDb.clickhouseHttpClient.queryPromise(`
SHOW TABLES FROM ${testClickhouseDb.options.database} LIKE '${table.options.tableName}'
`);
console.log('Table exists after deletion:', result);
expect(result.length).toEqual(0);
});
tap.test('should stream new entries', async (toolsArg) => {
const stream = table.watchNewEntries();
const subscription = stream.subscribe((entry) => {
@ -101,4 +91,14 @@ tap.test('should stream new entries', async (toolsArg) => {
subscription.unsubscribe();
});
tap.test('should delete the table', async () => {
await table.delete();
// Verify table deletion
const result = await testClickhouseDb.clickhouseHttpClient.queryPromise(`
SHOW TABLES FROM ${testClickhouseDb.options.database} LIKE '${table.options.tableName}'
`);
console.log('Table exists after deletion:', result);
expect(result.length).toEqual(0);
});
export default tap.start();