• 개요
@angular/router/testing

RouterTestingModule

클래스
사용 중단 권고

Sets up the router to be used for testing.

사용 중단을 권고합니다.

Use provideRouter or RouterModule/RouterModule.forRoot instead. This module was previously used to provide a helpful collection of test fakes, most notably those for Location and LocationStrategy. These are generally not required anymore, as MockPlatformLocation is provided in TestBed by default. However, you can use them directly with provideLocationMocks.

API

    
      class RouterTestingModule {}
    
    

설명

Sets up the router to be used for testing.

The modules sets up the router to be used for testing. It provides spy implementations of Location and LocationStrategy.

사용 시 참고사항

Example

beforeEach(() => {
  TestBed.configureTestingModule({
    imports: [
      RouterModule.forRoot(
        [{path: '', component: BlankCmp}, {path: 'simple', component: SimpleCmp}]
      )
    ]
  });
});
상세 내용으로 이동