我正在对一个函数进行单元测试,我想模拟或跳过 sequelize 模型查询。
create = async (req: Request) => {
const {
headers: { traceId },
params: { userId, testTypeId },
user: loginUser
} = req;
const testType = await TestType.findByPk(testTypeId);
我想模拟或跳过 findByPk 函数,因为它是一个数据库调用。