test: update setup prompt stubs for type-check

This commit is contained in:
Andrey Avtomonov 2026-05-21 20:08:12 +02:00
parent 8e17bf25af
commit c275748eda
4 changed files with 11 additions and 5 deletions

View file

@ -236,9 +236,11 @@ describe('KtxBigQueryScanConnector', () => {
it('constructs for discovery without dataset scope and lists tables through one region information schema query', async () => {
const createQueryJob = vi.fn(
async (input: { query: string; params?: Record<string, unknown>; location?: string }) => [
async (
input: { query: string; params?: Record<string, unknown>; location?: string },
): ReturnType<KtxBigQueryClient['createQueryJob']> => [
{
getQueryResults: async () => [
getQueryResults: async (): ReturnType<KtxBigQueryQueryJob['getQueryResults']> => [
[
{ table_schema: 'analytics', table_name: 'orders', table_type: 'BASE TABLE' },
{ table_schema: 'analytics', table_name: 'order_clone', table_type: 'CLONE' },
@ -260,10 +262,10 @@ describe('KtxBigQueryScanConnector', () => {
);
const clientFactory: KtxBigQueryClientFactory = {
createClient: vi.fn(() => ({
getDatasets: vi.fn(async () => [[{ id: 'analytics' }, { id: 'mart' }]]),
getDatasets: vi.fn(async () => [[{ id: 'analytics' }, { id: 'mart' }]] as [{ id: string }[]]),
dataset: vi.fn((datasetId: string) => ({
get: vi.fn(async () => [{ id: datasetId }]),
getTables: vi.fn(async () => [[]]),
getTables: vi.fn(async () => [[]] as [never[]]),
})),
createQueryJob,
})),

View file

@ -101,7 +101,9 @@ function makePromptAdapter(options: {
if (options.initialValues && options.initialValues.length > 0) {
return options.initialValues;
}
return options.options.length > 0 ? options.options.map((option) => option.value) : ['back'];
return options.options.length > 0
? options.options.map((option: { value: string }) => option.value)
: ['back'];
}),
select: vi.fn(async ({ message }) => {
if (message.startsWith('Save ') && message.includes(' or refine tables?')) {

View file

@ -57,6 +57,7 @@ function prompts(values: { multiselect?: string[][]; select?: string[] }): KtxSe
return {
multiselect: vi.fn(async () => multiselectValues.shift() ?? []),
select: vi.fn(async () => selectValues.shift() ?? 'back'),
autocomplete: vi.fn(async () => selectValues.shift() ?? 'back'),
text: vi.fn(async () => ''),
password: vi.fn(async () => undefined),
cancel: vi.fn(),

View file

@ -1410,6 +1410,7 @@ describe('setup status', () => {
const embeddings = vi.fn(async () => embeddingResults.shift() ?? { status: 'back' as const, projectDir: tempDir });
const databasePrompts = {
multiselect: vi.fn(async () => ['back']),
autocompleteMultiselect: vi.fn(async () => ['back']),
select: vi.fn(async () => 'back'),
text: vi.fn(),
password: vi.fn(),