57 lines
1.8 KiB
JavaScript
57 lines
1.8 KiB
JavaScript
/**
|
|
* Created by abhatkha on 5/8/17.
|
|
*/
|
|
//This is test suite for baseVO
|
|
|
|
describe("Test TicketVO", function() {
|
|
|
|
var entityObj
|
|
it("EntityVO test creation ", function() {
|
|
|
|
entityObj = new EntityVO();
|
|
expect(entityObj instanceof BaseVO).toEqual(true);
|
|
expect(entityObj instanceof EntityVO).toEqual(true);
|
|
|
|
});
|
|
|
|
it("EntityVO test initilization ", function() {
|
|
|
|
var entityProp= entityObj.getProps();
|
|
|
|
expect(entityProp).toEqual([ 'entityId', 'type', 'displayValue', 'classId' ]);
|
|
|
|
|
|
expect(entityObj.id).not.toBeDefined();
|
|
expect(entityObj.createDate).not.toBeDefined();
|
|
expect(entityObj.type).toEqual('');
|
|
|
|
expect(EntityVO.entityHas()).toBeFalsy();
|
|
expect(EntityVO.hasApprovalsFlow()).toBeFalsy();
|
|
expect(EntityVO.hasMetadata()).toBeFalsy();
|
|
expect(EntityVO.hasAttachments()).toBeFalsy();
|
|
|
|
});
|
|
|
|
it("EntityVO test postbuild ", function() {
|
|
|
|
entityObj.postBuild();
|
|
|
|
expect(entityObj.entityLink).toEqual('#/' + entityObj.type + '/' + encodeURIComponent(entityObj.entityId));
|
|
|
|
entityObj.type = EntityVO.TYPE_EMAIL_LINK;
|
|
entityObj.postBuild();
|
|
expect(entityObj.entityLink).toEqual('mailto:' + entityObj.displayValue);
|
|
|
|
entityObj.type = EntityVO.TYPE_INTEGER;
|
|
entityObj.postBuild();
|
|
expect(entityObj.entityLink).toEqual('javascript:void(0)');
|
|
|
|
entityObj.type = EntityVO.TYPE_ASSET;
|
|
entityObj.postBuild();
|
|
expect(entityObj.entityLink).toEqual('#/' + entityObj.type + '/' + encodeURIComponent(entityObj.entityId) + '/' + entityObj.classId);
|
|
|
|
entityObj.type = EntityVO.TYPE_URL;
|
|
entityObj.postBuild();
|
|
expect(entityObj.entityLink).toEqual(entityObj.entityId);
|
|
});
|
|
}); |