腾讯云
开发者社区
文档
建议反馈
控制台
登录/注册
首页
学习
活动
专区
工具
TVP
最新优惠活动
文章/答案/技术大牛
搜索
搜索
关闭
发布
精选内容/技术社群/优惠产品,
尽在小程序
立即前往
文章
问答
(9999+)
视频
沙龙
1
回答
expect
(
jest.fn
()).
toHaveBeenCalledWith
(...
expected
)
、
、
getByEmail:
jest.fn
(() => true), create(authService.validateUser).
toHaveBeenCalledWith
(loginPayload); })我得到了下
浏览 128
提问于2020-02-25
得票数 1
1
回答
如何运行与操作系统无关的Jest测试文件来检查路径?
、
、
假设我有以下几点:这在NIX操作系统上可以很好地工作。但是,这个测试在Windows平台上会失败,因为我应该编写测试的最佳方法是什么,使它们与操作系统无关
浏览 4
提问于2021-04-29
得票数 0
回答已采纳
1
回答
jest模拟函数将不会被调用,但console.log会证明它已被调用
、
(); const component = { cartExists:false, updateMyCart, createMyCart
toHaveBeenCalledWith
(1) .
toHaveBeenCalledWith
(2)它显示了被测试函数中的console.log(
jest.fn
()).
toHaveBeenCalledWith
(...
浏览 9
提问于2021-03-12
得票数 1
2
回答
Jest截断接收到的模拟调用列表
、
我有个测试会多次打电话给间谍:it("Fails but doesn't log all calls", () => { spy("1"); spy("3"); spy("5");
expect
(spy).
toHaveBeenCalledWith
浏览 8
提问于2022-06-17
得票数 0
回答已采纳
2
回答
基于Jest的模拟寄存_orderBy方法
、
、
、
from "lodash"; _.orderBy =
jest.fn
(); });Error:
expect
(<
浏览 1
提问于2020-03-10
得票数 1
2
回答
预期jest mock已在react测试库中使用参数调用失败
、
、
、
、
我希望这个测试能通过,但它失败了: it('should consume files on drop', () => { const fileindex], }, });
expect
(mock).toHaveB
浏览 15
提问于2020-10-18
得票数 5
回答已采纳
1
回答
嘲笑模拟函数在我的测试用例中不起作用
、
、
、
(next).
toHaveBeenCalledWith
(action); });
expect
(next).
toHaveBeenCalledWith
(action);});● analytics middleware › should make an analytics API ca
浏览 9
提问于2022-07-04
得票数 1
1
回答
如何在JEST中测试Window.postMessage()?
、
这一切都是完美的,但我无法将
Expected
与Received相匹配。我的测试 window.top.postMessage =
jest.fn
envId=1234"}';//, "*"';
expect
(window.top.postMessage
浏览 6
提问于2021-02-03
得票数 1
回答已采纳
2
回答
如何使用jest来模拟经过改进的函数?
、
、
with the xml', () => { })
expect
(result).toEqual(js)})TypeError: xml2js is not() util.promisify =
jest.fn
(
浏览 4
提问于2019-01-21
得票数 4
1
回答
开玩笑总是叫0次
、
、
、
、
. 我想我是在测试它的正确性:
expect
(postgres).
toHaveBeenCalledWith
('url')})pg-promise库返回一个默认函数但开玩笑说postgres(connection)从来没有发生过: <e
浏览 2
提问于2021-05-24
得票数 0
回答已采纳
4
回答
松散匹配jest.
toHaveBeenCalledWith
中的一个值
如何使用jest.
toHaveBeenCalledWith
测试对象?test('pageStats - publicationPage (will wait 1000ms)', done => { mockInstance.fire('viewState.currentPageIndex.change', 2) <
浏览 0
提问于2018-09-14
得票数 140
回答已采纳
1
回答
Jest测试:如何测试在axios调用中使用特定参数调用函数
、
、
、
、
(),spyOn和
toHaveBeenCalledWith
,但我只是被困住了。这就是我最后的结局: const id = 1; await deleteRecord(id);
expect
(notify).
toHav
浏览 24
提问于2022-10-27
得票数 -1
1
回答
如何在单元测试中触发FileReader的`onloadend`?
、
、
、
、
test("ImageUpload shows two buttons after an image has been uploaded", () => { const onloadend =
浏览 91
提问于2020-07-06
得票数 3
回答已采纳
1
回答
如何从react钩子中的组件对stateChange回调进行单元测试?
、
、
、
{ const handleStateChange =
jest.fn
(wrapper.find(TextField).at(0).props().error).toBe(
expect
(wrapper.find(TextField).at(0).props().helperText).toBe(
expec
浏览 8
提问于2019-07-23
得票数 0
回答已采纳
1
回答
如何在Vue应用程序中测试嵌套操作?
、
、
、
、
id: 'someId', type: 'postRoutes' await store.dispatch('myModule/saveSomeData', payload)
expect
(store.dispatch).
toHaveBeenCalledWith
('myModule/save
浏览 0
提问于2020-04-09
得票数 10
1
回答
Jest
jest.fn
,它被调用了,但是
expect
失败了
、
、
、
、
但是
expect
失败了,错误出现在代码下面。 const store = mockStore() <
浏览 2
提问于2021-02-26
得票数 1
1
回答
nodejs测试中的
expect
(
jest.fn
()).
toHaveBeenCalledWith
(...
expected
)错误
、
、
、
" let request : any = {} response.status =
jest.fn
().mockReturnValue(response) await Credit(req as Request,
浏览 8
提问于2022-11-20
得票数 0
回答已采纳
1
回答
即使间谍被调用,spyOn也会失败
、
、
wrapper.setState({ formData: { name: 'v1' } }); spy.mockRestore();这次测试失败了用/调用 <
浏览 3
提问于2017-05-21
得票数 1
回答已采纳
1
回答
如何测试不是模块的Node.JS脚本,并在调用它时立即运行?
、
、
、
、
我喜欢使用Javascript代替bash脚本。const shelljs = require("shelljs") shelljs.echo("'serve' is missing, please run 'npm ci'")} 我该如何测
浏览 3
提问于2021-02-15
得票数 1
回答已采纳
3
回答
在ReactiveNative中测试onLayout
、
我正在尝试使用@testing/ uses本机测试一个使用onLayout事件的组件,该组件通过组件道具使用一个setState函数,但该函数从未被调用:我怎么才能把这事做好?set the header height on layout', async () => { const mockHeight
浏览 0
提问于2019-09-16
得票数 7
回答已采纳
点击加载更多
扫码
添加站长 进交流群
领取专属
10元无门槛券
手把手带您无忧上云
相关
资讯
通过构建自己的JavaScript测试框架来了解JS测试
Vue3.0 源码解读-响应式系统之computed
Vue3.0 源码解读-响应式系统之effect
携程租车React Native单元测试实践
Golang测试:理念和工具
热门
标签
更多标签
云服务器
ICP备案
对象存储
腾讯会议
云直播
活动推荐
运营活动
广告
关闭
领券