diff --git a/src/app/modules/activities-management/store/activity-management.reducers.spec.ts b/src/app/modules/activities-management/store/activity-management.reducers.spec.ts index 894d24bd0..2f24b7b27 100644 --- a/src/app/modules/activities-management/store/activity-management.reducers.spec.ts +++ b/src/app/modules/activities-management/store/activity-management.reducers.spec.ts @@ -23,12 +23,12 @@ describe('activityManagementReducer', () => { expect(state.data).toEqual(activitiesFound); }); - it('on LoadActivitiesFail, message equal to Something went wrong fetching activities!', () => { + it('loading is false on LoadActivitiesFail', () => { const action = new actions.LoadActivitiesFail('error'); const state = activityManagementReducer(initialState, action); - expect(state.message).toEqual('Something went wrong fetching activities!'); + expect(state.isLoading).toBeFalsy(); }); it('on CreateActivity, isLoading is true', () => { @@ -48,12 +48,11 @@ describe('activityManagementReducer', () => { expect(state.isLoading).toEqual(false); }); - it('on CreateActivityFail, message equal to Something went wrong creating activities!', () => { + it('is Loading false on CreateActivityFail', () => { const action = new actions.CreateActivityFail('error'); const state = activityManagementReducer(initialState, action); - expect(state.message).toEqual('Something went wrong creating activities!'); expect(state.isLoading).toEqual(false); }); diff --git a/src/app/modules/activities-management/store/activity-management.reducers.ts b/src/app/modules/activities-management/store/activity-management.reducers.ts index 240b2be26..256593060 100644 --- a/src/app/modules/activities-management/store/activity-management.reducers.ts +++ b/src/app/modules/activities-management/store/activity-management.reducers.ts @@ -34,7 +34,10 @@ export function activityManagementReducer(state: ActivityState = initialState, a }; } case ActivityManagementActionTypes.LOAD_ACTIVITIES_FAIL: { - return { data: [], isLoading: false, message: 'Something went wrong fetching activities!', activityIdToEdit: '' }; + return { + ...state, + isLoading: false, + }; } case ActivityManagementActionTypes.CREATE_ACTIVITY: { @@ -55,10 +58,8 @@ export function activityManagementReducer(state: ActivityState = initialState, a case ActivityManagementActionTypes.CREATE_ACTIVITY_FAIL: { return { - data: [], + ...state, isLoading: false, - message: 'Something went wrong creating activities!', - activityIdToEdit: '', }; } @@ -133,7 +134,7 @@ export function activityManagementReducer(state: ActivityState = initialState, a }; } - default : { + default: { return state; } diff --git a/src/app/modules/customer-management/components/projects-type/store/project-type.reducers.spec.ts b/src/app/modules/customer-management/components/projects-type/store/project-type.reducers.spec.ts index b7d9a78ea..9327b4f38 100644 --- a/src/app/modules/customer-management/components/projects-type/store/project-type.reducers.spec.ts +++ b/src/app/modules/customer-management/components/projects-type/store/project-type.reducers.spec.ts @@ -54,12 +54,11 @@ describe('projectTypeReducer', () => { expect(state.isLoading).toEqual(false); }); - it('on CreateProjectTypeFail, message equal to Something went wrong creating projectType!', () => { + it('isLoading false on CreateProjectTypeFail', () => { const action = new actions.CreateProjectTypeFail('error'); const state = projectTypeReducer(initialState, action); - expect(state.message).toEqual('Something went wrong creating projectType!'); expect(state.isLoading).toEqual(false); }); diff --git a/src/app/modules/customer-management/components/projects-type/store/project-type.reducers.ts b/src/app/modules/customer-management/components/projects-type/store/project-type.reducers.ts index 5a1b5fb11..030105c2b 100644 --- a/src/app/modules/customer-management/components/projects-type/store/project-type.reducers.ts +++ b/src/app/modules/customer-management/components/projects-type/store/project-type.reducers.ts @@ -60,10 +60,8 @@ export const projectTypeReducer = (state: ProjectTypeState = initialState, actio case ProjectTypeActionTypes.CREATE_PROJECT_TYPE_FAIL: { return { - data: [], + ...state, isLoading: false, - message: 'Something went wrong creating projectType!', - projectTypeIdToEdit: '', }; } diff --git a/src/app/modules/shared/components/details-fields/details-fields.component.spec.ts b/src/app/modules/shared/components/details-fields/details-fields.component.spec.ts index 77e36a0a3..a17b1a0d2 100644 --- a/src/app/modules/shared/components/details-fields/details-fields.component.spec.ts +++ b/src/app/modules/shared/components/details-fields/details-fields.component.spec.ts @@ -1,3 +1,4 @@ +import { TechnologiesComponent } from './../technologies/technologies.component'; import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { provideMockStore, MockStore } from '@ngrx/store/testing'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; @@ -6,7 +7,6 @@ import { formatDate } from '@angular/common'; import { TechnologyState } from '../../store/technology.reducers'; import { allTechnologies } from '../../store/technology.selectors'; import { DetailsFieldsComponent } from './details-fields.component'; -import * as actions from '../../store/technology.actions'; import { ProjectState } from '../../../customer-management/components/projects/components/store/project.reducer'; import { getCustomerProjects } from '../../../customer-management/components/projects/components/store/project.selectors'; import { EntryState } from '../../../time-clock/store/entry.reducer'; @@ -61,7 +61,7 @@ describe('DetailsFieldsComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [DetailsFieldsComponent], + declarations: [DetailsFieldsComponent, TechnologiesComponent], providers: [provideMockStore({ initialState: state })], imports: [FormsModule, ReactiveFormsModule], }).compileComponents();