Skip to content

Commit

Permalink
chore: upgrade ava
Browse files Browse the repository at this point in the history
  • Loading branch information
gajus committed Jun 11, 2024
1 parent 7a0bc13 commit 4f5f762
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions packages/slonik/src/helpers.test/createIntegrationTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,16 +176,19 @@ export const createIntegrationTests = (
driverFactory,
});

const error: NotNullIntegrityConstraintViolationError | undefined =
await t.throwsAsync(
pool.any(sql.unsafe`
INSERT INTO person (name) VALUES (null)
`),
);
const error: Error | undefined = await t.throwsAsync(
pool.any(sql.unsafe`
INSERT INTO person (name) VALUES (null)
`),
);

t.true(error instanceof NotNullIntegrityConstraintViolationError);
t.is(error?.table, 'person');
t.is(error?.column, 'name');

const notNullIntegrityConstraintViolationError =
error as NotNullIntegrityConstraintViolationError;

t.is(notNullIntegrityConstraintViolationError?.table, 'person');
t.is(notNullIntegrityConstraintViolationError?.column, 'name');
});

test('properly handles terminated connections', async (t) => {
Expand All @@ -212,13 +215,15 @@ export const createIntegrationTests = (
driverFactory,
});

const error: InputSyntaxError | undefined = await t.throwsAsync(
const error: Error | undefined = await t.throwsAsync(
pool.any(sql.unsafe`SELECT WHERE`),
);

t.true(error instanceof InputSyntaxError);

t.is(error?.sql, 'SELECT WHERE');
const inputSyntaxError = error as InputSyntaxError;

t.is(inputSyntaxError?.sql, 'SELECT WHERE');

await pool.end();
});
Expand Down

0 comments on commit 4f5f762

Please sign in to comment.