我已经在angular 8应用程序中编写了一个jasmine测试,并且必须在之前的函数或规范中创建错误间谍。我尝试在beforeEach中包装间谍,并在describe函数中测试,但仍然得到相同的错误。可能的问题是什么。outStandingAgreementServiceSpy: jasmine.Spy;
let outStan
some stuff it('throws errors',function(done) { });当我试图运行这个测试时,它会给我带来错误Attempted to wrap getObj which is already wrappedbeforeEach(function () {});
sandbox.restore();
})
//some jobs }@Test在我的测试中,我用虚拟数据创建一个模拟,并将它们传递给实际函数type1、type2、type3 --现在有callmethod2(type3)作为依赖项,所以我不想执行该方法。所以在我的测试用例中我写了
when(mockA.callmethod2(any(type3.class))).thenReturn(mockM