From 4d455cebdf55e24b6a2a85d744ba82e4e91bbc6c Mon Sep 17 00:00:00 2001
From: Tifenn Guillas <tifenn.guillas@lam.fr>
Date: Thu, 16 Sep 2021 13:11:57 +0200
Subject: [PATCH] Tests on search reducer => DONE

---
 ...er.spec.ts => cone-search.reducer.spec.ts} |   0
 .../store/reducers/search.reducer.spec.ts     | 130 +++++++++++++++---
 2 files changed, 112 insertions(+), 18 deletions(-)
 rename client/src/app/instance/store/reducers/{cone-earch.reducer.spec.ts => cone-search.reducer.spec.ts} (100%)

diff --git a/client/src/app/instance/store/reducers/cone-earch.reducer.spec.ts b/client/src/app/instance/store/reducers/cone-search.reducer.spec.ts
similarity index 100%
rename from client/src/app/instance/store/reducers/cone-earch.reducer.spec.ts
rename to client/src/app/instance/store/reducers/cone-search.reducer.spec.ts
diff --git a/client/src/app/instance/store/reducers/search.reducer.spec.ts b/client/src/app/instance/store/reducers/search.reducer.spec.ts
index b5434670..f621f060 100644
--- a/client/src/app/instance/store/reducers/search.reducer.spec.ts
+++ b/client/src/app/instance/store/reducers/search.reducer.spec.ts
@@ -1,6 +1,7 @@
 import * as fromSearch from './search.reducer';
 import * as searchActions from '../actions/search.actions';
 import { Criterion, Pagination, PaginationOrder } from '../models';
+import { Action } from '@ngrx/store';
 
 describe('Search reducer', () => {
     it('unknown action should return the default state', () => {
@@ -576,22 +577,115 @@ describe('Search reducer', () => {
         expect(state).not.toBe(initialState);
     });
 
-    // it('unregister action should set registered to false', () => {
-    //     const initialState = {
-    //         ...fromSearch.initialState,
-    //         registered: true
-    //     };
-    //     const action = searchActions.unregister();
-    //     const state = fromSearch.searchReducer(initialState, action);
-    //
-    //     expect(state.registered).toBeFalsy();
-    //     expect(state).not.toBe(initialState);
-    // });
-
-    // it('should get registered', () => {
-    //     const action = {} as Action;
-    //     const state =  fromSearch.searchReducer(undefined, action);
-    //
-    //     expect(fromSearch.selectRegistered(state)).toBeFalsy();
-    // });
+    it('should get pristine', () => {
+        const action = {} as Action;
+        const state =  fromSearch.searchReducer(undefined, action);
+
+        expect(fromSearch.selectPristine(state)).toBeTruthy();
+    });
+
+    it('should get currentDataset', () => {
+        const action = {} as Action;
+        const state =  fromSearch.searchReducer(undefined, action);
+
+        expect(fromSearch.selectCurrentDataset(state)).toBeNull();
+    });
+
+    it('should get currentStep', () => {
+        const action = {} as Action;
+        const state =  fromSearch.searchReducer(undefined, action);
+
+        expect(fromSearch.selectCurrentStep(state)).toBeNull();
+    });
+
+    it('should get criteriaStepChecked', () => {
+        const action = {} as Action;
+        const state =  fromSearch.searchReducer(undefined, action);
+
+        expect(fromSearch.selectCriteriaStepChecked(state)).toBeFalsy();
+    });
+
+    it('should get outputStepChecked', () => {
+        const action = {} as Action;
+        const state =  fromSearch.searchReducer(undefined, action);
+
+        expect(fromSearch.selectOutputStepChecked(state)).toBeFalsy();
+    });
+
+    it('should get resultStepChecked', () => {
+        const action = {} as Action;
+        const state =  fromSearch.searchReducer(undefined, action);
+
+        expect(fromSearch.selectResultStepChecked(state)).toBeFalsy();
+    });
+
+    it('should get coneSearchAdded', () => {
+        const action = {} as Action;
+        const state =  fromSearch.searchReducer(undefined, action);
+
+        expect(fromSearch.selectIsConeSearchAdded(state)).toBeFalsy();
+    });
+
+    it('should get criteriaList', () => {
+        const action = {} as Action;
+        const state =  fromSearch.searchReducer(undefined, action);
+
+        expect(fromSearch.selectCriteriaList(state).length).toEqual(0);
+    });
+
+    it('should get outputList', () => {
+        const action = {} as Action;
+        const state =  fromSearch.searchReducer(undefined, action);
+
+        expect(fromSearch.selectOutputList(state).length).toEqual(0);
+    });
+
+    it('should get dataLengthIsLoading', () => {
+        const action = {} as Action;
+        const state =  fromSearch.searchReducer(undefined, action);
+
+        expect(fromSearch.selectDataLengthIsLoading(state)).toBeFalsy();
+    });
+
+    it('should get dataLengthIsLoaded', () => {
+        const action = {} as Action;
+        const state =  fromSearch.searchReducer(undefined, action);
+
+        expect(fromSearch.selectDataLengthIsLoaded(state)).toBeFalsy();
+    });
+
+    it('should get dataLength', () => {
+        const action = {} as Action;
+        const state =  fromSearch.searchReducer(undefined, action);
+
+        expect(fromSearch.selectDataLength(state)).toBeNull();
+    });
+
+    it('should get data', () => {
+        const action = {} as Action;
+        const state =  fromSearch.searchReducer(undefined, action);
+
+        expect(fromSearch.selectData(state).length).toEqual(0);
+    });
+
+    it('should get dataIsLoading', () => {
+        const action = {} as Action;
+        const state =  fromSearch.searchReducer(undefined, action);
+
+        expect(fromSearch.selectDataIsLoading(state)).toBeFalsy();
+    });
+
+    it('should get dataIsLoaded', () => {
+        const action = {} as Action;
+        const state =  fromSearch.searchReducer(undefined, action);
+
+        expect(fromSearch.selectDataIsLoaded(state)).toBeFalsy();
+    });
+
+    it('should get selectedData', () => {
+        const action = {} as Action;
+        const state =  fromSearch.searchReducer(undefined, action);
+
+        expect(fromSearch.selectSelectedData(state).length).toEqual(0);
+    });
 });
-- 
GitLab