SmartIT_Extensions/BMC/smart-it-full/test/app/person/person-profile-vo.spec.js

51 lines
2.2 KiB
JavaScript

describe("Test PersonProfileVO()", function () {
var personProfileVO;
it(" should create object ", function () {
personProfileVO = new PersonProfileVO();
expect(personProfileVO instanceof BaseVO).toEqual(true);
expect(personProfileVO instanceof PersonProfileVO).toEqual(true);
});
it(" should initilize objects with all properties ", function () {
var personProfileVOProps = personProfileVO.getProps();
expect(personProfileVOProps).toEqual(['id', 'createDate', 'firstName', 'lastName', 'fullName', 'department', 'email', 'company', 'phone', 'thumbnailMime', 'thumbnail', 'site',
'organization', 'loginId', 'available', 'jid', 'cell', 'fax', 'jobTitle', 'customFields', 'isSupportStaff', 'enabled', 'introduction', 'linkedIn', 'twitter', 'availableForAssignment', 'deskLocation', 'manager', 'costCenter', 'openTickets', 'accessMappings', 'supportGroups', 'following', 'type', 'isVIP', 'personId']);
personProfileVO.firstName = 'test';
personProfileVO.lastName = 'foo';
var personProfileVOFullName = personProfileVO.getFullName();
expect(personProfileVOFullName).toEqual('test foo');
personProfileVO.site = {
"address": 'test foo',
"city": 'test',
"street": 'foo',
"state": 'test',
"zip": 1233,
"country": 'test'
};
var personProfileVOSiteAddress = personProfileVO.getSiteAddress();
});
it('should execute when accessMappings contain data', function () {
personProfileVO.accessMappings = {
detailsEditAllowed: false,
timelineEditAllowed: false,
timelineEditAllowed: false,
relationsEditAllowed: false
};
personProfileVO.postBuild();
expect(personProfileVO.accessMappings).toBeTruthy();
})
it('should execute when accessMappings is empty', function () {
personProfileVO.accessMappings = {};
personProfileVO.postBuild();
expect(personProfileVO.accessMappings.detailsEditAllowed).toBe(true);
expect(personProfileVO.accessMappings.timelineEditAllowed).toBe(true);
expect(personProfileVO.accessMappings.relationsEditAllowed).toBe(true);
})
});