我使用Sinon在单元测试我的组件(用TypeScript和vue-class-component编写)时存根API调用。在将单元添加到单元测试之后,仍然调用原始方法(不返回存根值)。 it('should set the text to bar', async() => {
const stubbedApiResponse =() => {
return 'bar';
我有以下函数使用bind将上下文绑定到then链。当我尝试和测试,它抛出 TypeError: redisClient.hgetallAsync(...).bind is not a function
myFunc() {
let self = this;
return redisClient.hgetallAsync('abcde')
.bind({ ap