React native opening URL jest测试:如何在React National中测试URL的打开?

校服杀人魔
校服杀人魔
订阅者
277
文章
0
粉丝
测试交流评论132字数 99阅读0分19秒阅读模式
摘要我正在尝试编写一个测试用例,用于在我的react原生应用程序中测试URL。这是我的模拟 从“导入{Linking}”;反应本机“;; 开玩笑mock('react-native/L...

我正在尝试编写一个测试用例,用于在我的react原生应用程序中测试URL。这是我的模拟

import { Linking } from "react-native";
jest.mock('react-native/Libraries/Linking/Linking', () => {
  return {
    openURL: jest.fn()
  }
})
Linking.openURL.mockImplementation(() => true)

这是我的测试文章源自玩技e族-https://www.playezu.com/193910.html

test('open google url',async ()=>{
  expect(Linking.openURL()).toHaveBeenCalled('https://www.google.com/')
})

但是我得到了这个错误,我该怎么办?文章源自玩技e族-https://www.playezu.com/193910.html

软件测试工具文章源自玩技e族-https://www.playezu.com/193910.html 文章源自玩技e族-https://www.playezu.com/193910.html

 
匿名

发表评论

匿名网友
:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:
确定

拖动滑块以完成验证