summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArundathi Patil <arundpil@in.ibm.com>2018-09-07 21:58:10 +0530
committerIBM602-PC0F1E3C\Arundathi <arundpil@in.ibm.com>2018-09-07 21:58:24 +0530
commit5a4fdb5990320c7ab1538b981231c49f0f6942be (patch)
tree829733337e0abdc2164c6f491a3f32b3c50175bb
parent7415e4d5e32168abb9165a682c4b393a51820bb4 (diff)
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 <arundpil@in.ibm.com>
-rw-r--r--src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.spec.ts30
1 files changed, 30 insertions, 0 deletions
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