From 5cd6f095297bcdaa2e7586c70be89756ed2e9768 Mon Sep 17 00:00:00 2001
From: FORESTIER Fabien <fabien.forestier@soprasteria.com>
Date: Thu, 24 May 2018 17:38:04 +0200
Subject: [PATCH] Fix tests

---
 .../metadata-list/metadata-list.component.spec.ts      | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/webapp/src/app/geosource/components/metadata-list/metadata-list.component.spec.ts b/webapp/src/app/geosource/components/metadata-list/metadata-list.component.spec.ts
index 71a58b4e..ec7d847d 100644
--- a/webapp/src/app/geosource/components/metadata-list/metadata-list.component.spec.ts
+++ b/webapp/src/app/geosource/components/metadata-list/metadata-list.component.spec.ts
@@ -13,6 +13,7 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
 import { MockComponent } from 'ng2-mock-component';
 import { SuggestionComponent, FilterListComponent } from '..';
 import { FilterDetailComponent } from '../filter-list/filter-detail/filter-detail.component';
+import { PaginatorComponent } from '../../../shared/components/paginator/paginator.component';
 
 describe('MetadataListComponent', () => {
   const datasetList = [{
@@ -70,7 +71,8 @@ describe('MetadataListComponent', () => {
         MockComponent({ selector: 'app-sort' }),
         SuggestionComponent,
         FilterListComponent,
-        FilterDetailComponent
+        FilterDetailComponent,
+        PaginatorComponent
       ],
       imports: [
         MatCardModule,
@@ -115,7 +117,7 @@ describe('MetadataListComponent', () => {
     it('should initialize the page index', () => {
       // When
       component.ngOnInit();
-      expect(component.paginator.pageIndex).toEqual(5);
+      expect(component.paginator.pageIndex).toEqual(6); // Value of the service plus 1
     });
 
     it('should get list of metadata from service', () => {
@@ -137,7 +139,7 @@ describe('MetadataListComponent', () => {
     it('should initialize the page index from service', () => {
       // When
       component.search();
-      expect(component.paginator.pageIndex).toEqual(2);
+      expect(component.paginator.pageIndex).toEqual(3); // Value of the service plus 1
     });
 
     it('should initialize the page size from service', () => {
@@ -149,7 +151,7 @@ describe('MetadataListComponent', () => {
     it('should get count of metadata from service', () => {
       // When
       component.search();
-      expect(component.metadata_total).toBe(10);
+      expect(component.paginator.length).toBe(10);
     });
 
     it('should get the list of metadata from service', () => {
-- 
GitLab