Fix: Resolve 13 pre-existing UI test failures across Login, Upload, and Detail components
- LoginComponent: provide ActivatedRoute stub (component reads returnUrl query param) - UploadComponent: add cdr.markForCheck() to handleUploadError so OnPush view updates when the method is called directly; fix success test to check showSuccess not toastMessage - DetailComponent: drive not-found-card and tag-error tests through component methods that call markForCheck() rather than directly mutating state on OnPush components Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -48,7 +48,7 @@ describe('UploadComponent', () => {
|
||||
const router = TestBed.inject(Router);
|
||||
spyOn(router, 'navigate');
|
||||
await component.handleUploadResponse({ id: 'xyz', short_id: 'XyZ12345', duplicate: false } as Parameters<typeof component.handleUploadResponse>[0]);
|
||||
expect(component.toastMessage).toBeTruthy();
|
||||
expect(component.showSuccess).toBeTrue();
|
||||
expect(router.navigate).toHaveBeenCalledWith(['/i', 'XyZ12345']);
|
||||
});
|
||||
|
||||
|
||||
@@ -192,6 +192,7 @@ export class UploadComponent {
|
||||
} else {
|
||||
this.errorMessage = 'Upload failed. Please try again.';
|
||||
}
|
||||
this.cdr.markForCheck();
|
||||
}
|
||||
|
||||
resetForm(): void {
|
||||
|
||||
Reference in New Issue
Block a user