-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #724 from aneoconsulting/form-name-line-component-…
…tests chore: tests for form name line component
- Loading branch information
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
src/app/dashboard/components/form-name-line.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { FormNameLineComponent } from './form-name-line.component'; | ||
|
||
describe('FormNameLineComponent', () => { | ||
const component = new FormNameLineComponent(); | ||
component.line = 'line'; | ||
component.ngOnInit(); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
|
||
it('should init', () => { | ||
expect(component.lineForm.value.name).toEqual('line'); | ||
}); | ||
|
||
describe('onSubmit', () => { | ||
|
||
const spySubmit = jest.spyOn(component.submitChange, 'emit'); | ||
|
||
it('should submit if there is a value', () => { | ||
component.onSubmit(); | ||
expect(spySubmit).toHaveBeenCalledWith('line'); | ||
}); | ||
|
||
it('should submit empty if there no value', () => { | ||
component.lineForm.value.name = null; | ||
component.onSubmit(); | ||
expect(spySubmit).toHaveBeenCalledWith(''); | ||
}); | ||
}); | ||
|
||
it('should cancel', () => { | ||
const spyCancel = jest.spyOn(component.cancelChange, 'emit'); | ||
component.onCancel(); | ||
expect(spyCancel).toHaveBeenCalled(); | ||
}); | ||
|
||
it('should track by status', () => { | ||
expect(component.trackByStatus(0, {value: 'value', name: 'name'})).toEqual('value'); | ||
}); | ||
}); |
8df46d9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JUnit
Files coverage (91%)