diff options
author | Arundathi Patil <arundpil@in.ibm.com> | 2018-08-30 15:26:57 +0530 |
---|---|---|
committer | Takamune Cho <tc012c@att.com> | 2018-08-30 17:48:39 +0000 |
commit | 7296d55883c315d8fa77fee031acdc9f04ca2dca (patch) | |
tree | dbf12f8669ac8dcbd6eab03df04541c016cee0f8 /src/app/vnfs/myvnfs/myvnfs.component.spec.ts | |
parent | 805af9f3efa1f7b23b28f4dc0ab19b3fbb8ac52c (diff) |
mynfs.component- added test cases
added test case to test and cover the new method 'validateVnfName()'
in myvnfs.component.
Issue-ID: APPC-1064
Change-Id: I5e45480efd7c18ced7d56b01e3dbb7aff4f3d9e8
Signed-off-by: Arundathi Patil <arundpil@in.ibm.com>
Diffstat (limited to 'src/app/vnfs/myvnfs/myvnfs.component.spec.ts')
-rw-r--r-- | src/app/vnfs/myvnfs/myvnfs.component.spec.ts | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/app/vnfs/myvnfs/myvnfs.component.spec.ts b/src/app/vnfs/myvnfs/myvnfs.component.spec.ts index 4defb4a..5220931 100644 --- a/src/app/vnfs/myvnfs/myvnfs.component.spec.ts +++ b/src/app/vnfs/myvnfs/myvnfs.component.spec.ts @@ -173,4 +173,34 @@ describe('MyvnfsComponent', () => { component.navigateToReference({paramData : 'data'}); expect(JSON.parse(sessionStorage.getItem('updateParams'))).toEqual({paramData : 'data'}); }); + + it('should test validateVnfName function with empty name value', ()=>{ + component.validateVnfName(''); + expect(component.errorMessage).toBe(''); + expect(component.invalid).toBe(true); + }); + + it('should test validateVnfName function with name value leading and trailing white spaces', ()=>{ + component.validateVnfName(' name '); + expect(component.errorMessage).toBe('Leading and trailing spaces are not allowed'); + expect(component.invalid).toBe(true); + }); + + it('should test validateVnfName function with name including more than one space', ()=>{ + component.validateVnfName('na me'); + expect(component.errorMessage).toBe('More than one space is not allowed in VNF Type'); + expect(component.invalid).toBe(true); + }); + + it('should test validateVnfName function with name length greated than 150', ()=>{ + component.validateVnfName('namenamenamenamenamenamenamenanamenamenamenamenamenamenamenanamenamenamenamenamenamenamenanamenamenamenamenamenamenamenanamenamenamenamenamenamenamenanamenamenamenamenamenamenamenanamenamenamenamenamenamenamenanamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenanamenamnamenamename'); + expect(component.errorMessage).toBe('VNF Type should be of minimum one character and maximum 150 character'); + expect(component.invalid).toBe(true); + }); + + it('should test validateVnfName function with valid name value', ()=>{ + component.validateVnfName('name'); + expect(component.errorMessage).toBe(''); + expect(component.invalid).toBe(false); + }); });
\ No newline at end of file |