Skip to content

Commit 64122e9

Browse files
fix(tests): add explicit types to integration test queries
Fix TypeScript implicit any errors in migrate integration tests. - Add explicit type parameters to sql query results - Specify return types for all database queries - Resolves CI/CD build failure Fixes #39
1 parent cc0bfdd commit 64122e9

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

tests/integration/migrate.integration.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ DROP TABLE IF EXISTS test_periodic_table;
177177
// STEP 5: Verify table exists in database
178178
// ============================================
179179

180-
const tables = await sql(`
180+
const tables = await sql<Array<{ tablename: string }>>(`
181181
SELECT tablename FROM pg_tables
182182
WHERE schemaname = 'public'
183183
AND tablename = 'test_periodic_table'
@@ -187,7 +187,7 @@ DROP TABLE IF EXISTS test_periodic_table;
187187
expect(tables[0].tablename).toBe('test_periodic_table');
188188

189189
// Verify data was inserted
190-
const data = await sql('SELECT * FROM test_periodic_table WHERE "AtomicNumber" = 10');
190+
const data = await sql<Array<{ Element: string; Symbol: string }>>('SELECT * FROM test_periodic_table WHERE "AtomicNumber" = 10');
191191
expect(data).toHaveLength(1);
192192
expect(data[0].Element).toBe('Neon');
193193
expect(data[0].Symbol).toBe('Ne');
@@ -206,7 +206,7 @@ DROP TABLE IF EXISTS test_periodic_table;
206206
// STEP 7: Verify schema_migrations updated
207207
// ============================================
208208

209-
const migrations = await sql(`
209+
const migrations = await sql<Array<{ version: string; applied_at: Date }>>(`
210210
SELECT version, applied_at
211211
FROM schema_migrations
212212
WHERE version = $1
@@ -230,7 +230,7 @@ DROP TABLE IF EXISTS test_periodic_table;
230230
// STEP 9: Verify table dropped
231231
// ============================================
232232

233-
const tablesAfterRollback = await sql(`
233+
const tablesAfterRollback = await sql<Array<{ tablename: string }>>(`
234234
SELECT tablename FROM pg_tables
235235
WHERE schemaname = 'public'
236236
AND tablename = 'test_periodic_table'
@@ -242,7 +242,7 @@ DROP TABLE IF EXISTS test_periodic_table;
242242
// STEP 10: Verify schema_migrations updated
243243
// ============================================
244244

245-
const migrationsAfterRollback = await sql(`
245+
const migrationsAfterRollback = await sql<Array<{ version: string }>>(`
246246
SELECT version
247247
FROM schema_migrations
248248
WHERE version = $1
@@ -260,7 +260,7 @@ DROP TABLE IF EXISTS test_periodic_table;
260260
expect(upAgainOutput).toMatch(/applied|/i);
261261

262262
// Verify table exists again
263-
const tablesReapplied = await sql(`
263+
const tablesReapplied = await sql<Array<{ tablename: string }>>(`
264264
SELECT tablename FROM pg_tables
265265
WHERE schemaname = 'public'
266266
AND tablename = 'test_periodic_table'

0 commit comments

Comments
 (0)