-
Notifications
You must be signed in to change notification settings - Fork 2
/
test.js
39 lines (34 loc) · 786 Bytes
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
'use strict'
const fastify = require('fastify')()
const sequelizeFastify = require('./src/index')
const chalk = require('chalk')
// test cases
// TODO:
// eslint-disable-next-line
test('database connection', done => {
fastify.register(
sequelizeFastify,
{
instance: 'db',
sequelizeOptions: {
dialect: 'mysql',
database: 'sequelize',
username: 'root',
password: 'root',
host: 'localhost',
port: 3306
}
}
)
.ready(async () => {
try {
await fastify.db.authenticate()
console.log(
chalk.green('Database connection is successfully established.')
)
done()
} catch (err) {
done(`Connection could not established: ${err}`)
}
})
})