我正在尝试为getUserByUserId()
编写集成测试。如何为带有mysql2的节点设置集成测试?
const service = {
pool: await mysql.connect(host, dbName, dbUser, dbPassword);,
async getUserByUserId(userId) {
const query = `select * from user where userId =?`;
const [rows] = await this.pool.execute(query, userId);
return rows;
},
};