TestFunction我正在尝试从接口在我的测试用例中实现以下方法Moacha
(fn: Func): Test;
这是实现
describe("testing get request", () => {
it(() => {
const res = request(app).get("/get-page");
expect(res.status).to.equal(200);
});
});
我得到的错误是这样的:
TypeError: Test argument "title" should be a string. Received type "function"
it当我在匿名函数之前添加标题时,它工作正常。知道为什么我不能实现只需要一个函数的方法。
接口来自index.d.ts
interface TestFunction {
(fn: Func): Test;
(fn: AsyncFunc): Test;
(title: string, fn?: Func): Test;
(title: string, fn?: AsyncFunc): Test;
only: ExclusiveTestFunction;
skip: PendingTestFunction;
retries(n: number): void;
}