Skip to content

Conversation

@jorgecod
Copy link
Contributor

@jorgecod jorgecod commented Apr 7, 2020

  • Get, Create and Edit Users

StoreModule.forRoot(reducers, {
metaReducers,
}),
!environment.production ? StoreDevtoolsModule.instrument() : [],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this line replace lines 78-79-80?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated this line

component.isEdit = false;
spyOn(store, 'dispatch');
component.onSubmit(project);
expect(store.dispatch).toHaveBeenCalledWith(new actions.PostProject(project));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a better action name would be CreateProject(project)

spyOn(store, 'dispatch');
component.onSubmit(project);
expect(component.savedProject.emit).toHaveBeenCalled();
expect(store.dispatch).toHaveBeenCalledWith(new actions.PutProject(project));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's change from PutProject to UpdateProject


it('details field validity', () => {
const details = component.projectForm.controls.details;
it('description field validity', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's change the test name to:
it('checks if description field is valid',
I know it's not your code but let's fix this.

@Output() cancelForm = new EventEmitter();

constructor(private formBuilder: FormBuilder) {
constructor(private formBuilder: FormBuilder, private store: Store<any>) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Store<any> ?
I think we have to use Store<ProjectsStore> or so

constructor(public payload: Project) {}
}

export class PutProjectSuccess implements Action {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UpdateProjectSuccess

constructor(public payload: Project) {}
}

export class PutProjectFail implements Action {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UpdateProjectFail

);

@Effect()
postProject$: Observable<Action> = this.actions$.pipe(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

createProject$

);

@Effect()
putProject$: Observable<Action> = this.actions$.pipe(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updateProject$

isLoading: boolean;

constructor(private projectService: ProjectService) {
constructor(private store: Store<any>) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Store => Store


@Injectable()
export class ProjectEffects {
constructor(private actions$: Actions, private projectService: ProjectService, private store: Store<any>) {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're not using the store at all. Why are we injecting it here?

@enriquezrene enriquezrene merged commit f933cea into master Apr 7, 2020
@enriquezrene enriquezrene deleted the 64/save-projects-API branch April 7, 2020 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants