Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand All @@ -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);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -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: '',
};
}

Expand Down Expand Up @@ -133,7 +134,7 @@ export function activityManagementReducer(state: ActivityState = initialState, a
};
}

default : {
default: {
return state;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: '',
};
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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';
Expand Down Expand Up @@ -61,7 +61,7 @@ describe('DetailsFieldsComponent', () => {

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [DetailsFieldsComponent],
declarations: [DetailsFieldsComponent, TechnologiesComponent],
providers: [provideMockStore({ initialState: state })],
imports: [FormsModule, ReactiveFormsModule],
}).compileComponents();
Expand Down