How do I add svg files via MatIconRegistry in unit tests?

前端 未结 6 2051
不思量自难忘°
不思量自难忘° 2021-02-05 10:16

I\'m currently implementing \'unit testing\' in my angular application. However, if I run them, I receive multiple warnings/errors similar to this one: \'Error retrieving

6条回答
  •  旧巷少年郎
    2021-02-05 10:47

    What you could do is install ng-mocks and use MockModule to mock the MatIconModule in your tests e.g.:

    beforeEach(async(() => {
      TestBed.configureTestingModule({
        imports: [MockModule(MatIconModule)],
      }).compileComponents();
    }));
    

提交回复
热议问题