mirror of
https://github.com/Kaelio/ktx.git
synced 2026-06-10 08:05:14 +02:00
refactor(historic-sql): route dialect support through driver registry
This commit is contained in:
parent
ad2471da74
commit
65cca7bd04
2 changed files with 37 additions and 4 deletions
|
|
@ -0,0 +1,23 @@
|
|||
import { describe, expect, it } from 'vitest';
|
||||
import { queryHistoryDialectForConnection } from '../../../../../src/context/ingest/adapters/historic-sql/connection-dialect.js';
|
||||
|
||||
describe('queryHistoryDialectForConnection', () => {
|
||||
it.each([
|
||||
['postgres', 'postgres'],
|
||||
['bigquery', 'bigquery'],
|
||||
['snowflake', 'snowflake'],
|
||||
] as const)('returns %s when query history is enabled', (driver, dialect) => {
|
||||
expect(queryHistoryDialectForConnection({ driver, context: { queryHistory: { enabled: true } } })).toBe(dialect);
|
||||
});
|
||||
|
||||
it.each(['sqlite', 'mysql', 'clickhouse', 'sqlserver'] as const)(
|
||||
'returns null for %s because no historic-SQL reader is registered',
|
||||
(driver) => {
|
||||
expect(queryHistoryDialectForConnection({ driver, context: { queryHistory: { enabled: true } } })).toBeNull();
|
||||
},
|
||||
);
|
||||
|
||||
it('returns null when query history is disabled', () => {
|
||||
expect(queryHistoryDialectForConnection({ driver: 'postgres', context: { queryHistory: { enabled: false } } })).toBeNull();
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue