Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70440

Ionic 5 Unit Tests with routerLink

$
0
0

@alexortizl wrote:

I’m developing an Ionic 5 App. I was testing a component like this:

beforeEach(async(() => {
    TestBed.configureTestingModule({
      declarations: [HomePage],
      imports: [MocksModule, IonicModule.forRoot()]
    }).compileComponents();

    fixture = TestBed.createComponent(HomePage);
    component = fixture.componentInstance;
    fixture.detectChanges();
  }));

It was working fine but after I added:

<ion-button routerLink="/settings">
    <ion-icon slot="icon-only" name="settings-outline"></ion-icon>
 </ion-button>

The test fails with:

Failed: R3InjectorError(DynamicTestModule)[NavController -> UrlSerializer -> UrlSerializer]: 
  NullInjectorError: No provider for UrlSerializer!

In MocksModule I export a stub directive as recommended in the Angular docs I believe the error is related to the implementation of RouterLink inside IonicModule.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70440

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>