i have written test for my api with jest . i added function that calls my api in test file as below:
import AuthManager from \"../Client/Modules/Auth/AuthMan
I faced with window.confirm
This is my solution for angular fw.
let spyOnWindow: jasmine.Spy;
beforeEach((() => {
TestBed.configureTestingModule({
declarations: [...],
imports: [...],
providers: [...]
}).compileComponents().then(() => {
...
spyOnWindow = spyOn(window,'confirm');
...
});
Some test case
it('showModal testing function with delete an event', () => {
spyOnWindow.and.returnValue(true);
...
}
it('showModal testing function with delete an event', () => {
spyOnWindow.and.returnValue(false);
...
}