如何使用mysql2设置节点的集成测试?

时间:2019-07-03 17:42:18

标签: node.js express mysql2

我正在尝试为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;
  },
}; 

0 个答案:

没有答案