我有以下的健康检查功能
export default function handler(req, res) {
res.status(200).json({ message: "Hello from Next.js!" });
}
我有下面的测试
import handler from "./healthcheck"
describe("Healthcheck", () => {
test("that the application is live with a status of 200", () => {
目前正在尝试测试一个按钮'onPress‘是否在点击后被调用,但我遇到了一些问题。在我用SignUp.test.js编写的fires onPress function when button is clicked测试用例中,它能够找到按钮等等,但是当模拟单击时,它会说: Sign Up Page › fires onPress function when button is clicked
expect(jest.fn()).toHaveBeenCalled()
Expected number of calls: >= 1
Received numb
当调用模块中的函数时,我很难弄清楚如何用jest测试外部库方法。
鉴于这种打字本课程:
import transport from "app/customApiLibrary";
const { api } = transport;
// myServiceClass.ts
export class MyServiceClass {
getSomeStuff(): Promise<any> {
return api.get("myservice/end/point/");
}
}
let serviceStuff = new My
我已经试图弄清楚这一点已经有一段时间了,但我不能让它工作!我在互联网上找到了一些例子,但没有什么能解决它,每次我运行我的测试时都会得到: Expected number of calls: 1
Received number of calls: 0
> 186 | expect(wrapper.vm.EventBus.$on).toHaveBeenCalledTimes(1); 该组件如下所示: import {EventBus} from 'eventbus'
export default{
data(){ return {}},
我正在尝试用jest测试firebase云消息传递,但我的mock函数出现了错误……
如何测试所有函数调用?
expect(jest.fn()).toHaveBeenCalled()
Expected mock function to have been called.
import { Sentry, SentrySeverity } from 'react-native-sentry';
import RNFirebase from 'react-native-firebase';
import Veery from 'react-native-ve
我在模块中有一个名为handlelistOfTemplates的函数,它调用另一个文件中定义的操作。我想测试一下,当handlelistOfTemplates被调用时,actions文件中的函数是用正确的参数调用的。
我的容器组件:
import React from 'react';
import { connect } from 'react-redux';
import {bindActionCreators} from 'redux';
import * as getData from '../../services/DataS