From e0613d5bcb24bea0c307643f9aaef16d61a7fa35 Mon Sep 17 00:00:00 2001
From: Tifenn Guillas <tifenn.guillas@lam.fr>
Date: Thu, 24 Sep 2020 16:37:43 +0200
Subject: [PATCH] Tests on shared datatable components => DONE

---
 .../renderer/detail.component.spec.ts         | 44 +++++-----
 .../renderer/download.component.spec.ts       | 54 ++++++------
 .../renderer/image.component.spec.ts          | 54 ++++++------
 .../datatable/renderer/json.component.spec.ts | 51 +++++------
 .../datatable/renderer/link.component.spec.ts | 88 +++++++++----------
 5 files changed, 146 insertions(+), 145 deletions(-)

diff --git a/src/app/shared/datatable/renderer/detail.component.spec.ts b/src/app/shared/datatable/renderer/detail.component.spec.ts
index af336c71..eb798187 100644
--- a/src/app/shared/datatable/renderer/detail.component.spec.ts
+++ b/src/app/shared/datatable/renderer/detail.component.spec.ts
@@ -1,22 +1,22 @@
-// import { ComponentFixture, TestBed } from '@angular/core/testing';
-// import { RouterTestingModule } from '@angular/router/testing';
-//
-// import { DetailComponent } from './detail.component';
-//
-// describe('[Search][Result][Renderer] Component: DetailComponent', () => {
-//     let component: DetailComponent;
-//     let fixture: ComponentFixture<DetailComponent>;
-//
-//     beforeEach(() => {
-//         TestBed.configureTestingModule({
-//             declarations: [DetailComponent],
-//             imports: [RouterTestingModule]
-//         });
-//         fixture = TestBed.createComponent(DetailComponent);
-//         component = fixture.componentInstance;
-//     });
-//
-//     it('should create the component', () => {
-//         expect(component).toBeTruthy();
-//     });
-// });
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+import { RouterTestingModule } from '@angular/router/testing';
+
+import { DetailComponent } from './detail.component';
+
+describe('[Search][Result][Renderer] Component: DetailComponent', () => {
+    let component: DetailComponent;
+    let fixture: ComponentFixture<DetailComponent>;
+
+    beforeEach(() => {
+        TestBed.configureTestingModule({
+            declarations: [DetailComponent],
+            imports: [RouterTestingModule]
+        });
+        fixture = TestBed.createComponent(DetailComponent);
+        component = fixture.componentInstance;
+    });
+
+    it('should create the component', () => {
+        expect(component).toBeTruthy();
+    });
+});
diff --git a/src/app/shared/datatable/renderer/download.component.spec.ts b/src/app/shared/datatable/renderer/download.component.spec.ts
index f6cffed0..3e35a3e4 100644
--- a/src/app/shared/datatable/renderer/download.component.spec.ts
+++ b/src/app/shared/datatable/renderer/download.component.spec.ts
@@ -1,27 +1,27 @@
-// import { ComponentFixture, TestBed } from '@angular/core/testing';
-//
-// import { DownloadComponent } from './download.component';
-// import { environment } from "../../../../../environments/environment";
-//
-// describe('[Search][Result][Renderer] Component: DownloadComponent', () => {
-//     let component: DownloadComponent;
-//     let fixture: ComponentFixture<DownloadComponent>;
-//
-//     beforeEach(() => {
-//         TestBed.configureTestingModule({
-//             declarations: [DownloadComponent]
-//         });
-//         fixture = TestBed.createComponent(DownloadComponent);
-//         component = fixture.componentInstance;
-//     });
-//
-//     it('should create the component', () => {
-//         expect(component).toBeTruthy();
-//     });
-//
-//     it('#getHref() should return file url', () => {
-//         component.datasetName = 'dname';
-//         component.value = 'val';
-//         expect(component.getHref()).toBe(environment.apiUrl + '/download-file/dname/val');
-//     });
-// });
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { DownloadComponent } from './download.component';
+import { environment } from '../../../../environments/environment';
+
+describe('[Search][Result][Renderer] Component: DownloadComponent', () => {
+    let component: DownloadComponent;
+    let fixture: ComponentFixture<DownloadComponent>;
+
+    beforeEach(() => {
+        TestBed.configureTestingModule({
+            declarations: [DownloadComponent]
+        });
+        fixture = TestBed.createComponent(DownloadComponent);
+        component = fixture.componentInstance;
+    });
+
+    it('should create the component', () => {
+        expect(component).toBeTruthy();
+    });
+
+    it('#getHref() should return file url', () => {
+        component.datasetName = 'dname';
+        component.value = 'val';
+        expect(component.getHref()).toBe(environment.apiUrl + '/download-file/dname/val');
+    });
+});
diff --git a/src/app/shared/datatable/renderer/image.component.spec.ts b/src/app/shared/datatable/renderer/image.component.spec.ts
index a12b4fbb..dfa40c87 100644
--- a/src/app/shared/datatable/renderer/image.component.spec.ts
+++ b/src/app/shared/datatable/renderer/image.component.spec.ts
@@ -1,27 +1,27 @@
-// import { ComponentFixture, TestBed } from '@angular/core/testing';
-//
-// import { ImageComponent } from './image.component';
-// import { environment } from "../../../../../environments/environment";
-//
-// describe('[Search][Result][Renderer] Component: ImageComponent', () => {
-//     let component: ImageComponent;
-//     let fixture: ComponentFixture<ImageComponent>;
-//
-//     beforeEach(() => {
-//         TestBed.configureTestingModule({
-//             declarations: [ImageComponent]
-//         });
-//         fixture = TestBed.createComponent(ImageComponent);
-//         component = fixture.componentInstance;
-//     });
-//
-//     it('should create the component', () => {
-//         expect(component).toBeTruthy();
-//     });
-//
-//     it('#getValue() should return image url', () => {
-//         component.datasetName = 'dname';
-//         component.value = 'val';
-//         expect(component.getValue()).toEqual(environment.apiUrl + '/download-file/dname/val');
-//     });
-// });
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { ImageComponent } from './image.component';
+import { environment } from '../../../../environments/environment';
+
+describe('[Search][Result][Renderer] Component: ImageComponent', () => {
+    let component: ImageComponent;
+    let fixture: ComponentFixture<ImageComponent>;
+
+    beforeEach(() => {
+        TestBed.configureTestingModule({
+            declarations: [ImageComponent]
+        });
+        fixture = TestBed.createComponent(ImageComponent);
+        component = fixture.componentInstance;
+    });
+
+    it('should create the component', () => {
+        expect(component).toBeTruthy();
+    });
+
+    it('#getValue() should return image url', () => {
+        component.datasetName = 'dname';
+        component.value = 'val';
+        expect(component.getValue()).toEqual(environment.apiUrl + '/download-file/dname/val');
+    });
+});
diff --git a/src/app/shared/datatable/renderer/json.component.spec.ts b/src/app/shared/datatable/renderer/json.component.spec.ts
index 0253e7c9..322a6e8c 100644
--- a/src/app/shared/datatable/renderer/json.component.spec.ts
+++ b/src/app/shared/datatable/renderer/json.component.spec.ts
@@ -1,25 +1,26 @@
-// import { ComponentFixture, TestBed } from '@angular/core/testing';
-// import { NgxJsonViewerModule } from 'ngx-json-viewer';
-// import { ModalModule } from 'ngx-bootstrap/modal';
-// import { BsModalService } from 'ngx-bootstrap/modal';
-//
-// import { JsonComponent } from './json.component';
-//
-// describe('[Search][Result][Renderer] Component: JsonComponent', () => {
-//     let component: JsonComponent;
-//     let fixture: ComponentFixture<JsonComponent>;
-//
-//     beforeEach(() => {
-//         TestBed.configureTestingModule({
-//             declarations: [JsonComponent],
-//             imports: [NgxJsonViewerModule, ModalModule.forRoot()],
-//             providers: [BsModalService]
-//         });
-//         fixture = TestBed.createComponent(JsonComponent);
-//         component = fixture.componentInstance;
-//     });
-//
-//     it('should create the component', () => {
-//         expect(component).toBeTruthy();
-//     });
-// });
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { NgxJsonViewerModule } from 'ngx-json-viewer';
+import { ModalModule } from 'ngx-bootstrap/modal';
+import { BsModalService } from 'ngx-bootstrap/modal';
+
+import { JsonComponent } from './json.component';
+
+describe('[Search][Result][Renderer] Component: JsonComponent', () => {
+    let component: JsonComponent;
+    let fixture: ComponentFixture<JsonComponent>;
+
+    beforeEach(() => {
+        TestBed.configureTestingModule({
+            declarations: [JsonComponent],
+            imports: [NgxJsonViewerModule, ModalModule.forRoot()],
+            providers: [BsModalService]
+        });
+        fixture = TestBed.createComponent(JsonComponent);
+        component = fixture.componentInstance;
+    });
+
+    it('should create the component', () => {
+        expect(component).toBeTruthy();
+    });
+});
diff --git a/src/app/shared/datatable/renderer/link.component.spec.ts b/src/app/shared/datatable/renderer/link.component.spec.ts
index a7447f1a..4b2ffd8a 100644
--- a/src/app/shared/datatable/renderer/link.component.spec.ts
+++ b/src/app/shared/datatable/renderer/link.component.spec.ts
@@ -1,44 +1,44 @@
-// import { ComponentFixture, TestBed } from '@angular/core/testing';
-//
-// import { LinkComponent } from './link.component';
-//
-// describe('[Search][Result][Renderer] Component: LinkComponent', () => {
-//     let component: LinkComponent;
-//     let fixture: ComponentFixture<LinkComponent>;
-//
-//     beforeEach(() => {
-//         TestBed.configureTestingModule({
-//             declarations: [LinkComponent]
-//         });
-//         fixture = TestBed.createComponent(LinkComponent);
-//         component = fixture.componentInstance;
-//     });
-//
-//     it('should create the component', () => {
-//         expect(component).toBeTruthy();
-//     });
-//
-//     it('#getValue() should return link url', () => {
-//         component.config = {
-//             href: 'url',
-//             display: 'display',
-//             text: 'text',
-//             icon: 'icon',
-//             blank: true
-//         };
-//         component.value = 'val';
-//         expect(component.getValue()).toEqual('url');
-//     });
-//
-//     it('#getText() should return link text', () => {
-//         component.config = {
-//             href: 'url',
-//             display: 'display',
-//             text: 'text',
-//             icon: 'icon',
-//             blank: true
-//         };
-//         component.value = 'val';
-//         expect(component.getText()).toEqual('text');
-//     });
-// });
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { LinkComponent } from './link.component';
+
+describe('[Search][Result][Renderer] Component: LinkComponent', () => {
+    let component: LinkComponent;
+    let fixture: ComponentFixture<LinkComponent>;
+
+    beforeEach(() => {
+        TestBed.configureTestingModule({
+            declarations: [LinkComponent]
+        });
+        fixture = TestBed.createComponent(LinkComponent);
+        component = fixture.componentInstance;
+    });
+
+    it('should create the component', () => {
+        expect(component).toBeTruthy();
+    });
+
+    it('#getValue() should return link url', () => {
+        component.config = {
+            href: 'url',
+            display: 'display',
+            text: 'text',
+            icon: 'icon',
+            blank: true
+        };
+        component.value = 'val';
+        expect(component.getValue()).toEqual('url');
+    });
+
+    it('#getText() should return link text', () => {
+        component.config = {
+            href: 'url',
+            display: 'display',
+            text: 'text',
+            icon: 'icon',
+            blank: true
+        };
+        component.value = 'val';
+        expect(component.getText()).toEqual('text');
+    });
+});
-- 
GitLab