gpt4 book ai didi

javascript - 预期库 TypeError : expect(. ..).to Include 不是函数

转载 作者:行者123 更新时间:2023-12-02 11:29:33 27 4
gpt4 key购买 nike

我猜这是一个导入错误,但我似乎无法弄清楚如何,expect是最新的,如果没有它说我就无法让它运行

libarary TypeError: expect(...).toInclude is not a function

var request = require("supertest");
var {app} = require("./../server.js");
var {Show} = require("./../models/show");
var expect = require('expect');

describe("GET /show/:id", () => {
it("Should include the show name 'Arrow' in the body", (done) => {
request(app)
.get(`/show/${showName}`)
.expect(200)
.expect((res) => {
expect('hello world').toInclude('world')

})
.end(done);
});
})

});

最佳答案

更新:除了.toMatchObject之外,您还可以使用.toHaveProperty

<小时/>

对于任何使用 .toInclude 检查对象是否包含某些字段的人来说,新版本是 .toMatchObject

这是文档 reference

关于javascript - 预期库 TypeError : expect(. ..).to Include 不是函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49181672/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com