mirror of
https://github.com/Kaelio/ktx.git
synced 2026-06-13 08:15:14 +02:00
19 lines
911 B
TypeScript
19 lines
911 B
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import { normalizeBigQueryProjectId, normalizeBigQueryRegion } from '../../../src/context/connections/bigquery-identifiers.js';
|
|
|
|
describe('BigQuery identifier normalization', () => {
|
|
it('normalizes project ids and regions for information schema paths', () => {
|
|
expect(normalizeBigQueryProjectId('project-1')).toBe('project-1');
|
|
expect(normalizeBigQueryRegion('US')).toBe('us');
|
|
expect(normalizeBigQueryRegion('region-eu')).toBe('eu');
|
|
});
|
|
|
|
it('rejects malformed project ids and regions with caller-specific context', () => {
|
|
expect(() => normalizeBigQueryProjectId('project`1', 'table discovery')).toThrow(
|
|
'Invalid BigQuery project id for table discovery: project`1',
|
|
);
|
|
expect(() => normalizeBigQueryRegion('US;DROP', 'table discovery')).toThrow(
|
|
'Invalid BigQuery region for table discovery: US;DROP',
|
|
);
|
|
});
|
|
});
|