Skip to content

Commit b231d66

Browse files
committed
test(extension): Fix tests
1 parent 14274db commit b231d66

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

packages/extension/src/kernel-integration/handlers/execute-db-query.test.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ import { describe, it, expect, vi } from 'vitest';
33
import { executeDBQueryHandler } from './execute-db-query.ts';
44

55
describe('executeDBQueryHandler', () => {
6-
it('executes a database query', () => {
6+
it('executes a database query', async () => {
77
const mockExecuteDBQuery = vi.fn().mockReturnValueOnce([{ key: 'value' }]);
88

9-
const result = executeDBQueryHandler.implementation(
9+
const result = await executeDBQueryHandler.implementation(
1010
{ executeDBQuery: mockExecuteDBQuery },
1111
{
1212
sql: 'test-query',
@@ -17,19 +17,17 @@ describe('executeDBQueryHandler', () => {
1717
expect(result).toStrictEqual([{ key: 'value' }]);
1818
});
1919

20-
it('should propagate errors from executeDBQuery', () => {
20+
it('should propagate errors from executeDBQuery', async () => {
2121
const error = new Error('Query failed');
2222
const mockExecuteDBQuery = vi.fn().mockImplementationOnce(() => {
2323
throw error;
2424
});
2525

26-
// TODO:rekm Fix upstream types to allow sync handlers
27-
// eslint-disable-next-line @typescript-eslint/promise-function-async
28-
expect(() =>
26+
await expect(
2927
executeDBQueryHandler.implementation(
3028
{ executeDBQuery: mockExecuteDBQuery },
3129
{ sql: 'test-query' },
3230
),
33-
).toThrow(error);
31+
).rejects.toThrow(error);
3432
});
3533
});

packages/extension/src/kernel-integration/handlers/execute-db-query.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ export const executeDBQueryHandler: Handler<
2525
> = {
2626
...executeDBQuerySpec,
2727
hooks: { executeDBQuery: true },
28-
implementation: (
28+
implementation: async (
2929
{ executeDBQuery }: ExecuteDBQueryHooks,
3030
params: { sql: string },
31-
): Record<string, string>[] => {
31+
): Promise<Record<string, string>[]> => {
3232
return executeDBQuery(params.sql);
3333
},
3434
};

packages/extension/src/kernel-integration/handlers/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export const handlers = {
1515
sendVatCommand: sendVatCommandHandler,
1616
executeDBQuery: executeDBQueryHandler,
1717
launchVat: launchVatHandler,
18-
reloadConfig: reloadConfigHandler,
18+
reload: reloadConfigHandler,
1919
restartVat: restartVatHandler,
2020
terminateVat: terminateVatHandler,
2121
terminateAllVats: terminateAllVatsHandler,

0 commit comments

Comments
 (0)