Skip to content

Commit 5c705e8

Browse files
theonly1mealan-agius4
authored andcommittedJun 17, 2024·
fix(@schematics/angular): update schematics to use RouterModule when --routing flag is present
update schematics to use RouterModule instead of RouterTestingModule when generating a new project with the --routing flag Fixes #27691 (cherry picked from commit e3b8b78)
1 parent 405c148 commit 5c705e8

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed
 

‎packages/schematics/angular/application/files/module-files/src/app/app.component.spec.ts.template

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { TestBed } from '@angular/core/testing';<% if (routing) { %>
2-
import { RouterTestingModule } from '@angular/router/testing';<% } %>
2+
import { RouterModule } from '@angular/router';<% } %>
33
import { AppComponent } from './app.component';
44

55
describe('AppComponent', () => {
66
beforeEach(async () => {
77
await TestBed.configureTestingModule({<% if (routing) { %>
88
imports: [
9-
RouterTestingModule
9+
RouterModule.forRoot([])
1010
],<% } %>
1111
declarations: [
1212
AppComponent

‎tests/legacy-cli/e2e/assets/15.0-project/src/app/app.component.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { TestBed } from '@angular/core/testing';
2-
import { RouterTestingModule } from '@angular/router/testing';
2+
import { RouterModule } from '@angular/router';
33
import { AppComponent } from './app.component';
44

55
describe('AppComponent', () => {
66
beforeEach(async () => {
77
await TestBed.configureTestingModule({
88
imports: [
9-
RouterTestingModule
9+
RouterModule.forRoot([])
1010
],
1111
declarations: [
1212
AppComponent

‎tests/legacy-cli/e2e/assets/18-ssr-project-webpack/src/app/app.component.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { TestBed } from '@angular/core/testing';
2-
import { RouterTestingModule } from '@angular/router/testing';
2+
import { RouterModule } from '@angular/router';
33
import { AppComponent } from './app.component';
44

55
describe('AppComponent', () => {
66
beforeEach(() => TestBed.configureTestingModule({
7-
imports: [RouterTestingModule],
7+
imports: [RouterModule.forRoot([])],
88
declarations: [AppComponent]
99
}));
1010

0 commit comments

Comments
 (0)
Please sign in to comment.