SmartIT_Extensions/BMC/smart-it-full/test/app/feed/comment-vo.spec.js

50 lines
1.4 KiB
JavaScript

/**
* Created by abhatkha on 5/8/17.
*/
//This is test suite for baseVO
describe("Test CommentVO", function() {
var commentObj;
it(" should create object ", function() {
commentObj = new CommentVO();
expect(commentObj instanceof BaseVO).toEqual(true);
expect(commentObj instanceof CommentVO).toEqual(true);
});
it(" should initilize objects with all properties ", function() {
var commentObjProp= commentObj.getProps();
expect(commentObjProp).toEqual(['id', 'createDate','message', 'author', 'attachmentCount', 'attachments']);
expect(commentObj.id).toEqual('');
expect(commentObj.createDate).toBeNull();
expect(commentObj.message).toEqual('');
expect(commentObj.author).toBeNull();
expect(commentObj.attachmentCount ).toEqual(0);
expect(commentObj.attachments ).toEqual([]);
expect(commentObj.title).toEqual('');
});
it(" should return count for hasAttachments method ", function() {
expect(commentObj.hasAttachments()).toBeFalsy();
commentObj.attachmentCount = 5;
expect(commentObj.hasAttachments()).toBeTruthy();
});
it(" should run postBuild method ", function() {
commentObj.attachments = [{}];
commentObj.postBuild();
commentObj.attachmentCount = 0;
commentObj.postBuild();
});
});