can just do:
import { MatIcon } from '@angular/material/icon';
import { MatIconTestingModule } from '@angular/material/icon/testing';
describe('MyComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [MyComponent, MatIcon],
imports: [MatIconTestingModule],
}).compileComponents();
}));
...
});
This will generate a test icon rendering without the HTTP request.
NOTE: Newer versions of Angular, e.g., >16, may produce an error unless you remove import { MatIcon }
.