From: Arundathi Patil Date: Fri, 7 Sep 2018 16:28:10 +0000 (+0530) Subject: reference-dataform- added test case X-Git-Tag: 1.4.0~13 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=5a4fdb5990320c7ab1538b981231c49f0f6942be;p=appc%2Fcdt.git reference-dataform- added test case wrote test case to test and cover validateVnfcName function Issue-ID: APPC-1064 Change-Id: I453f8d3d971db1af82c1db80dd0e901fc4c0810b Signed-off-by: Arundathi Patil --- diff --git a/src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.spec.ts b/src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.spec.ts index 41d3288..a3d87d2 100644 --- a/src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.spec.ts +++ b/src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.spec.ts @@ -1054,4 +1054,34 @@ describe('ReferenceDataformComponent', () => { component.fileChange(input); })); + + it('should test validateVnfcName function with empty name value', ()=>{ + component.validateVnfcName(''); + expect(component.errorMessage).toBe(''); + expect(component.invalid).toBe(true); + }); + + it('should test validateVnfcName function with name value leading and trailing white spaces', ()=>{ + component.validateVnfcName(' name '); + expect(component.errorMessage).toBe('Leading and trailing spaces are not allowed'); + expect(component.invalid).toBe(true); + }); + + it('should test validateVnfcName function with name including more than one space', ()=>{ + component.validateVnfcName('na me'); + expect(component.errorMessage).toBe('More than one space is not allowed in VNFC Type'); + expect(component.invalid).toBe(true); + }); + + it('should test validateVnfcName function with name length greated than 150', ()=>{ + component.validateVnfcName('namenamenamenamenamenamenamenanamenamenamenamenamenamenamenanamenamenamenamenamenamenamenanamenamenamenamenamenamenamenanamenamenamenamenamenamenamenanamenamenamenamenamenamenamenanamenamenamenamenamenamenamenanamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenanamenamnamenamename'); + expect(component.errorMessage).toBe('VNFC Type should be of minimum one character and maximum 50 character'); + expect(component.invalid).toBe(true); + }); + + it('should test validateVnfcName function with valid name value', ()=>{ + component.validateVnfcName('name'); + expect(component.errorMessage).toBe(''); + expect(component.invalid).toBe(false); + }); }); \ No newline at end of file