Closed wfpaisa closed 1 year ago
I'm submitting a:
Please could you help me to solve this error, I have used this solution using mudules and it works, but in standalone components it does not work.
let reCaptchaV3Service: jasmine.SpyObj<ReCaptchaV3Service>; describe('@modules/signin/pages - UserComponent', () => { const reCaptchaV3ServiceSpy = jasmine.createSpyObj(ReCaptchaV3Service, ['execute']); beforeEach(async () => { await TestBed.configureTestingModule({ imports: [ RecaptchaV3Module, ], providers: [ { provide: RECAPTCHA_V3_SITE_KEY, useValue: environment.captcha }, { provide: ReCaptchaV3Service, useValue: reCaptchaV3ServiceSpy }, ]}).compileComponents(); } it('should handle captchaGetToken()', fakeAsync(() => { reCaptchaV3Service = TestBed.inject(ReCaptchaV3Service) as jasmine.SpyObj<ReCaptchaV3Service>; reCaptchaV3Service.execute.and.returnValue(of('123xxx')); component.captchaGetToken(); tick(10); expect(reCaptchaV3Service).toHaveBeenCalled(); }));
Thanks :)
Hi @wfpaisa ! This seems more like a question around generic jasmine mocks setup, and is thus better suited to a site such as StackOverflow
jasmine
Summary
I'm submitting a:
Description
Please could you help me to solve this error, I have used this solution using mudules and it works, but in standalone components it does not work.
Thanks :)