bot/tests/database.test.ts

14 lines
479 B
TypeScript
Raw Normal View History

2023-02-08 12:00:37 +00:00
import { database, config } from '../src/modules'
import { createConnection } from 'mysql2/promise'
describe('test database system', () => {
test('Validate rows', async () => {
return database.getConnection().then(async conn1 => {
2023-02-08 12:44:38 +00:00
const [rows1] = await conn1.execute('SELECT * FROM statement;')
2023-02-08 12:00:37 +00:00
const conn2 = await createConnection(config)
2023-02-08 12:44:38 +00:00
const [rows2] = await conn2.execute(`SELECT * FROM statement;`)
2023-02-08 12:00:37 +00:00
expect(rows1).toEqual(rows2)
})
})
})