#Having Unit Test errors
6 messages · Page 1 of 1 (latest)
@obsidian oak Please do not post pictures of code (especially photos of a physical screen) as they are difficult to read and difficult to correct (as you cannot copy code from a screenshot to modify it).
This is not a good test IMPO.
Don't do component.bmoEmployeeForm = formBuilder.group you mock things outside of the thing you are testing. Do Not Mock things that are part of the thing you are testing.
component.bmoEmployeeForm.setValue({
id: '',
firstName: '',
lastName: '',
email: '',
})
component.addSigner();
expect(BssActions.addSignatories).toHaveBeenCalled():
Better would be:
expect(BssActions.addSignatories).toHaveBeenCalledOnceWith({ payload: expectedSignatories }):
And to give your form real values instead of empty strings