Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(angular): migrate deprecated RouterTestingModule #1843

Merged
merged 4 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions angular-standalone/base/src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { provideRouter } from '@angular/router';
import { AppComponent } from './app.component';

describe('AppComponent', () => {
it('should create the app', () => {
TestBed.overrideComponent(AppComponent, {
add: {
imports: [RouterTestingModule]
}
});
it('should create the app', async () => {
await TestBed.configureTestingModule({
imports: [AppComponent],
providers: [provideRouter([])]
}).compileComponents();

const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app).toBeTruthy();
Expand Down
11 changes: 5 additions & 6 deletions angular-standalone/official/list/src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import { TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { provideRouter } from '@angular/router';

import { AppComponent } from './app.component';

describe('AppComponent', () => {

beforeEach(async () => {
TestBed.overrideComponent(AppComponent, {
add: {
imports: [RouterTestingModule]
}
});
await TestBed.configureTestingModule({
imports: [AppComponent],
providers: [provideRouter([])]
}).compileComponents();
});

it('should create the app', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import { TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { provideRouter } from '@angular/router';

import { AppComponent } from './app.component';

describe('AppComponent', () => {
beforeEach(async () => {
TestBed.overrideComponent(AppComponent, {
add: {
imports: [RouterTestingModule]
}
});
await TestBed.configureTestingModule({
imports: [AppComponent],
providers: [provideRouter([])]
}).compileComponents();
});

it('should create the app', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { provideRouter } from '@angular/router';

import { FolderPage } from './folder.page';

Expand All @@ -8,11 +8,10 @@ describe('FolderPage', () => {
let fixture: ComponentFixture<FolderPage>;

beforeEach(async () => {
TestBed.overrideComponent(FolderPage, {
add: {
imports: [RouterTestingModule]
}
});
await TestBed.configureTestingModule({
imports: [FolderPage],
providers: [provideRouter([])]
}).compileComponents();

fixture = TestBed.createComponent(FolderPage);
component = fixture.componentInstance;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { provideRouter } from '@angular/router';

import { TabsPage } from './tabs.page';

Expand All @@ -8,11 +8,10 @@ describe('TabsPage', () => {
let fixture: ComponentFixture<TabsPage>;

beforeEach(async () => {
TestBed.overrideComponent(TabsPage, {
add: {
imports: [RouterTestingModule]
}
});
await TestBed.configureTestingModule({
imports: [TabsPage],
providers: [provideRouter([])]
}).compileComponents();
});

beforeEach(() => {
Expand Down
4 changes: 2 additions & 2 deletions angular/official/sidemenu/src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { TestBed } from '@angular/core/testing';

import { RouterTestingModule } from '@angular/router/testing';
import { RouterModule } from '@angular/router';

import { AppComponent } from './app.component';

Expand All @@ -13,7 +13,7 @@ describe('AppComponent', () => {
await TestBed.configureTestingModule({
declarations: [AppComponent],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [RouterTestingModule.withRoutes([])],
imports: [RouterModule.forRoot([])],
}).compileComponents();
});

Expand Down
Loading