/** * Created by abhatkha on 5/9/17. */ //This is test suite for baseVO describe("Test AttachmentVO", function() { var attachObj it("AttachmentVO object creation ", function() { attachObj = new AttachmentVO(); expect(attachObj instanceof BaseVO).toEqual(true); expect(attachObj instanceof AttachmentVO).toEqual(true); }); it("AttachmentVO object initilization ", function() { var attachProp= attachObj.getProps(); expect(attachProp).toEqual([ 'id', 'createDate','name', 'modifiedDate', 'fileContentType', 'fileName', 'fileSize','size', 'type', 'contentType', 'thumbnail', 'attachmentReference' ]); expect(attachObj.id).toEqual(''); expect(attachObj.createDate).toBeNull(); expect(attachObj.name).toEqual(''); expect(attachObj.modifiedDate).toEqual(''); expect(attachObj.size ).toEqual(0); expect(attachObj.type).toEqual(''); expect(attachObj.contentType ).toEqual(''); expect(attachObj.thumbnail ).toEqual(''); expect(attachObj.attachmentReference ).toEqual(''); }); it("AttachmentVO test getFileGenericIconClass method", function() { expect(attachObj.getFileGenericIconClass('test.xls')).toEqual('icon-xls_square'); expect(attachObj.getFileGenericIconClass('test.jpg')).toEqual('icon-image_square'); }); it("AttachmentVO test base64Validate method", function() { expect(attachObj.base64Validate.test('YW51cGJoYXRraGFuZGU=')).toBeTruthy(); }); it("AttachmentVO test normalizeThumbnail method", function() { expect(attachObj.normalizeThumbnail('test,test2;test3')).toEqual(''); expect(attachObj.normalizeThumbnail('test,images,YW51cGJoYXRraGFuZGU=')).toEqual(''); expect(attachObj.normalizeThumbnail('base64image/,YW51cGJoYXRraGFuZGU=')).toEqual('base64image/,YW51cGJoYXRraGFuZGU='); expect(attachObj.normalizeThumbnail('test,R0lGOD==')).toEqual('data:image/gif;base64,R0lGOD=='); }); it("AttachmentVO test postBuild method", function() { attachObj.fileSize = 1024; attachObj.postBuild(); expect(attachObj.size).toEqual(1024); attachObj.contentType = null; attachObj.fileContentType = null; attachObj.name = 'anup.txt'; attachObj.postBuild(); expect(attachObj.contentType).toEqual('txt'); }); });