Skip to content

Commit dbf944c

Browse files
committed
adding test for conditional env checking
1 parent 90b51e2 commit dbf944c

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

src/app/app-routing.module.spec.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { TestBed, waitForAsync } from '@angular/core/testing';
2+
import { RouterTestingModule } from '@angular/router/testing';
3+
import { AppRoutingModule } from './app-routing.module';
4+
5+
describe('AppRoutingModule', () => {
6+
beforeEach(waitForAsync(() => {
7+
TestBed.configureTestingModule({
8+
imports: [
9+
RouterTestingModule
10+
],
11+
declarations: [
12+
AppRoutingModule
13+
],
14+
}).compileComponents();
15+
}));
16+
17+
it('should create routes when not legacy', () => {
18+
const fixture = TestBed.createComponent(AppRoutingModule);
19+
const app = fixture.componentInstance;
20+
expect(app.routes).toBeTruthy();
21+
});
22+
23+
});

src/app/app-routing.module.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,6 @@ if (isNotLegacy) {
5151
imports: [RouterModule.forRoot(routes)],
5252
exports: [RouterModule],
5353
})
54-
export class AppRoutingModule { }
54+
export class AppRoutingModule {
55+
routes = routes;
56+
}

0 commit comments

Comments
 (0)