it('should upload logo - inProgress', () => {
const testUploadProgress: number = 45;
api.uploadImageWithProgress.and.returnValue(of({
type: HttpEventType.UploadProgress,
loaded: testUploadProgress
}));
const event = {
target: {
files: [
new File(["data:image/png;base64,R0lGODlhDAAMAKIFAF5LAP/zxAAAANyuAP/gaP///wAAAAAAACH5BAEAAAUALAAAAAAMAAwAAAMlWLPcGjDKFYi9lxKBOaGcF35DhWHamZUW0K4mAbiwWtuf0uxFAgA7"], 'test', { type: 'image/png' }),
]
}
}
fixture.detectChanges();
component.onLogoUpload(event);
fixture.detectChanges();
// console.log(component);
expect(component.isLoading).toBeTrue();
expect(component.isLargeThenParent).toBeFalse();
expect(component.uploadProgress).toBe(testUploadProgress, 'Unexpected upload progress');
});
This is one of my assertions. The commented console.log gives me component with property uploadProgress: 45. But when I try to access it right after that logging, it becomes equal to 0 (its default value). So my last assertion is not as expected. Need help to define what is the reason.
Aucun commentaire:
Enregistrer un commentaire