Skip to content

Commit

Permalink
fix node tests for psql
Browse files Browse the repository at this point in the history
  • Loading branch information
Satont committed Oct 24, 2024
1 parent d5d61e4 commit 0613168
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions packages/psql/__tests__/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import pg from 'pg';
import { session } from 'grammy';
import * as utils from '@grammyjs/storage-utils';

test.describe('Tests', () => {
test.describe('Tests', (it) => {
const client = new pg.Client({
user: 'postgres',
password: 'postgres',
Expand All @@ -15,6 +15,18 @@ test.describe('Tests', () => {
port: 5432,
});

test.before(async () => {
await client.connect();
});

test.after(async () => {
await client.end();
});

test.afterEach(async () => {
await client.query('DELETE FROM sessions');
});

test.it('Pizza counter test', async () => {
const bot = utils.createBot();

Expand All @@ -36,14 +48,7 @@ test.describe('Tests', () => {
await bot.handleUpdate(utils.createMessage(bot, 'second').update);
});

test.it('Should be changed', async () => {
const client = new pg.Client({
user: 'postgres',
password: 'postgres',
database: 'postgres',
host: 'localhost',
port: 5432,
});
test.it('Simple string', async () => {
const bot = utils.createBot(false);

bot.use(session({
Expand All @@ -62,8 +67,4 @@ test.describe('Tests', () => {
await bot.handleUpdate(utils.createMessage(bot, 'first').update);
await bot.handleUpdate(utils.createMessage(bot, 'second').update);
});

test.after(async () => {
await client.end();
});
});

0 comments on commit 0613168

Please sign in to comment.