我试图使用jest.useFakeTimers()使我的firebase + jest测试在处理日期和超时时保持稳定。但是,如果我试图从模拟数据库中读取任何内容,测试就会超时,并抛出Exceeded timeout of 5000 ms for a test。Github repro:import * as admin from "firebase-admin";
// jest.setTi
我正在尝试用Jest编写单元测试,以模拟利用moment.js库的几部分代码。我尝试测试的import和代码块: import moment from 'moment'; const durationSinceLastEmail = moment.duration(moment(newDate())
.diff(moment(user.passwordRecoveryTokenRequestDate
我试图模拟newDate()来返回一个特定的日期。以下代码:jest.spyOn(global, 'Date').mockImplementation(() => now)
给出一个编译错误:Argumentof type '() => Date' is not assignable to parameter of type '() =>