From 32d756e2040937c5131aa77e839c9ab16a3b6118 Mon Sep 17 00:00:00 2001
From: Jeremie BRISON <ext.sopra.jbrison@grandlyon.com>
Date: Mon, 16 Nov 2020 10:52:48 +0100
Subject: [PATCH] fix error

---
 src/app/map/services/map.service.spec.ts                   | 2 +-
 .../shared/components/logo-card/logo-card.component.html   | 2 +-
 .../components/modal-filter/modal-filter.component.spec.ts | 2 +-
 .../components/search/search.component.spec.ts             | 2 +-
 .../structure-details/structure-details.component.html     | 2 +-
 .../structure-details/structure-details.component.spec.ts  | 7 ++++---
 .../structure-opening-status.component.html                | 2 +-
 src/app/structure-list/services/search.service.spec.ts     | 2 +-
 8 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/src/app/map/services/map.service.spec.ts b/src/app/map/services/map.service.spec.ts
index de3b0e0fa..eb3b55054 100644
--- a/src/app/map/services/map.service.spec.ts
+++ b/src/app/map/services/map.service.spec.ts
@@ -42,6 +42,6 @@ describe('MapService', () => {
     expect(service.getMarker(2)).toEqual(null);
   });
   it('should not get marker, empty', () => {
-    expect(service.getMarker(1)).toEqual(null);
+    expect(service.getMarker(2)).toEqual(null);
   });
 });
diff --git a/src/app/shared/components/logo-card/logo-card.component.html b/src/app/shared/components/logo-card/logo-card.component.html
index dd679586b..3cc35f78f 100644
--- a/src/app/shared/components/logo-card/logo-card.component.html
+++ b/src/app/shared/components/logo-card/logo-card.component.html
@@ -1,4 +1,4 @@
-<div fxLayout="column" fxLayoutAlign="center center">
+<div fxLayout="column" fxLayoutAlign="center center" *ngIf="name">
   <img [src]="'assets/logos/' + getLogoKey(name) + '.svg'" [alt]="'logo ' + name" />
   <p>{{ name }}</p>
 </div>
diff --git a/src/app/structure-list/components/modal-filter/modal-filter.component.spec.ts b/src/app/structure-list/components/modal-filter/modal-filter.component.spec.ts
index 113f340a6..d81c0bea5 100644
--- a/src/app/structure-list/components/modal-filter/modal-filter.component.spec.ts
+++ b/src/app/structure-list/components/modal-filter/modal-filter.component.spec.ts
@@ -76,7 +76,7 @@ describe('ModalFilterComponent', () => {
       { id: '167', text: 'training', count: 0 },
     ];
     component.checkedModules = modules;
-    const category: Category = { name: 'morefilters', modules: [modules[0], modules[1], modules[2]] };
+    const category: Category = new Category({ name: 'morefilters', modules: [modules[0], modules[1], modules[2]] });
     component.categories = [category];
     component.clearFilters();
     expect(component.checkedModules.length).toEqual(3);
diff --git a/src/app/structure-list/components/search/search.component.spec.ts b/src/app/structure-list/components/search/search.component.spec.ts
index 3b89eff5b..647c986a8 100644
--- a/src/app/structure-list/components/search/search.component.spec.ts
+++ b/src/app/structure-list/components/search/search.component.spec.ts
@@ -33,7 +33,7 @@ describe('SearchComponent', () => {
 
   // applyFilter function
   it('should emit filters', () => {
-    const filter: Filter[] = [new Filter('nomDeVotreStructure', 'valInput', false)];
+    const filter: Filter[] = [new Filter('nomDeVotreStructure', 'valInput')];
     spyOn(component.searchEvent, 'emit');
     component.applyFilter('valInput');
     expect(component.searchEvent.emit).toHaveBeenCalled();
diff --git a/src/app/structure-list/components/structure-details/structure-details.component.html b/src/app/structure-list/components/structure-details/structure-details.component.html
index 5edf8c8a5..742bd4ac9 100644
--- a/src/app/structure-list/components/structure-details/structure-details.component.html
+++ b/src/app/structure-list/components/structure-details/structure-details.component.html
@@ -1,4 +1,4 @@
-<div class="structrue-details-container">
+<div class="structrue-details-container" *ngIf="structure">
   <!-- Header info -->
   <div fxLayout="row" class="structrue-details-block" fxLayoutAlign="baseline baseline" fxLayoutGap="20px">
     <em class="ic-arrow-left clickable" (click)="close()"></em>
diff --git a/src/app/structure-list/components/structure-details/structure-details.component.spec.ts b/src/app/structure-list/components/structure-details/structure-details.component.spec.ts
index c3ac8e9ae..46990d19a 100644
--- a/src/app/structure-list/components/structure-details/structure-details.component.spec.ts
+++ b/src/app/structure-list/components/structure-details/structure-details.component.spec.ts
@@ -1,3 +1,4 @@
+import { HttpClientTestingModule } from '@angular/common/http/testing';
 import { ComponentFixture, TestBed } from '@angular/core/testing';
 
 import { StructureDetailsComponent } from './structure-details.component';
@@ -8,9 +9,9 @@ describe('StructureDetailsComponent', () => {
 
   beforeEach(async () => {
     await TestBed.configureTestingModule({
-      declarations: [ StructureDetailsComponent ]
-    })
-    .compileComponents();
+      declarations: [StructureDetailsComponent],
+      imports: [HttpClientTestingModule],
+    }).compileComponents();
   });
 
   beforeEach(() => {
diff --git a/src/app/structure-list/components/structure-opening-status/structure-opening-status.component.html b/src/app/structure-list/components/structure-opening-status/structure-opening-status.component.html
index a03a3a762..13e779d1b 100644
--- a/src/app/structure-list/components/structure-opening-status/structure-opening-status.component.html
+++ b/src/app/structure-list/components/structure-opening-status/structure-opening-status.component.html
@@ -1,4 +1,4 @@
-<div class="statusStructure" fxLayout="row" fxLayoutAlign="start center">
+<div class="statusStructure" fxLayout="row" fxLayoutAlign="start center" *ngIf="structure">
   <div>
     <span *ngIf="structure.isOpen; else closed" class="ico-dot-available"></span>
     <span>{{ structure.openDisplay() }}</span>
diff --git a/src/app/structure-list/services/search.service.spec.ts b/src/app/structure-list/services/search.service.spec.ts
index 666955f99..1103e2236 100644
--- a/src/app/structure-list/services/search.service.spec.ts
+++ b/src/app/structure-list/services/search.service.spec.ts
@@ -28,7 +28,7 @@ describe('SearchService', () => {
     const m1: Module = { id: '176', text: 'strm1', count: 0 };
     const m2: Module = { id: '173', text: 'strm2', count: 0 };
     const m3: Module = { id: '172', text: 'strm3', count: 0 };
-    const category: Category = { name: 'strCateg', modules: [m1, m2, m3] };
+    const category: Category = new Category({ name: 'strCateg', modules: [m1, m2, m3] });
     const result = service.setCountModules(category, structureCount);
     expect(result.modules[0].count).toBe(2);
     expect(result.modules[1].count).toBe(1);
-- 
GitLab