-
Notifications
You must be signed in to change notification settings - Fork 219
/
_shell.service.spec.ts
40 lines (34 loc) · 1.1 KB
/
_shell.service.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import { TestBed, inject } from '@angular/core/testing';
<% if (props.auth) { -%>
import { AuthenticationGuard, AuthenticationService } from '@app/auth';
import { MockAuthenticationService } from '@app/auth/authentication.service.mock';
<% } -%>
import { ShellComponent } from './shell.component';
import { Shell } from './shell.service';
describe('Shell', () => {
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [
ShellComponent
<% if (props.auth) { -%>
],
providers: [
AuthenticationGuard,
{ provide: AuthenticationService, useClass: MockAuthenticationService },
<% } -%>
]
});
});
describe('childRoutes', () => {
it('should create routes as children of shell', () => {
// Prepare
const testRoutes = [{ path: 'test' }];
// Act
const result = Shell.childRoutes(testRoutes);
// Assert
expect(result.path).toBe('<%= props.ui === 'ionic' && props.layout === 'tabs' ? 'tabs' : '' -%>');
expect(result.children).toBe(testRoutes);
expect(result.component).toBe(ShellComponent);
});
});
});