Skip to content
Snippets Groups Projects
Commit 63d1a78d authored by Tifenn Guillas's avatar Tifenn Guillas
Browse files

Tests with DOM => DONE

parent e2a2494d
No related branches found
No related tags found
2 merge requests!29Develop,!16Resolve "Add tests for portal module"
...@@ -47,6 +47,7 @@ describe('PortalHomeComponent', () => { ...@@ -47,6 +47,7 @@ describe('PortalHomeComponent', () => {
fixture = TestBed.createComponent(PortalHomeComponent); fixture = TestBed.createComponent(PortalHomeComponent);
component = fixture.componentInstance; component = fixture.componentInstance;
store = TestBed.inject(MockStore); store = TestBed.inject(MockStore);
document.body.innerHTML = '<link id="favicon" href="">';
})); }));
it('should create the component', () => { it('should create the component', () => {
...@@ -61,6 +62,7 @@ describe('PortalHomeComponent', () => { ...@@ -61,6 +62,7 @@ describe('PortalHomeComponent', () => {
{ label: 'Admin', icon: 'fas fa-tools', routerLink: '/admin' } { label: 'Admin', icon: 'fas fa-tools', routerLink: '/admin' }
]; ];
expect(component.links).toEqual(expected); expect(component.links).toEqual(expected);
expect(component.favIcon.href).toEqual('http://localhost/favicon.ico');
}); });
it('should execute ngOnInit lifecycle and add admin link depending on user rights', () => { it('should execute ngOnInit lifecycle and add admin link depending on user rights', () => {
......
...@@ -47,7 +47,7 @@ export class PortalHomeComponent implements OnInit, OnDestroy { ...@@ -47,7 +47,7 @@ export class PortalHomeComponent implements OnInit, OnDestroy {
} }
ngOnInit() { ngOnInit() {
// this.favIcon.href = 'favicon.ico'; this.favIcon.href = 'favicon.ico';
const adminLink = { label: 'Admin', icon: 'fas fa-tools', routerLink: '/admin' }; const adminLink = { label: 'Admin', icon: 'fas fa-tools', routerLink: '/admin' };
if (!this.config.authenticationEnabled) { if (!this.config.authenticationEnabled) {
this.links.push(adminLink); this.links.push(adminLink);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment