【发布时间】:2017-05-05 23:43:05
【问题描述】:
我有一个具有此功能的文件
export const doSomething = (arg1, arg2) => {
SomeClass.someFunction()
OtherClass.otherFunction()
}
我查看了人们如何在网上嘲笑东西,但没有一个能解决我的问题。基本上在我的开玩笑测试中我想打电话
test('sendText to send text with the proper number', () => {
doSomething()
expect(SomeClass.someFunction).toBeCalled();
})
我不知道该怎么做。我在网上看到的所有东西都在测试函数的顶层模拟了一个函数,然后传递到他们想要测试的实际函数中,这与我想要做的非常不同。
SomeClass 是我为跟踪而导入的第三方事物,我只想验证它是否被调用。 OtherClass 也一样。我该怎么做?
【问题讨论】:
标签: react-native jestjs