SmartIT_Extensions/BMC/smart-it-full/test/app/release/release-plan-details-direct...

60 lines
2.1 KiB
JavaScript

/**
* Created by npatil2.
*/
describe('Directives: releasePlanDetails', function () {
var scope, compile, $httpBackend, releaseTabIds, rootScope;
beforeEach(module('myitsmApp', 'templates'));
beforeEach(inject(function ($injector, $compile, $rootScope, _releaseTabIds_) {
var getLocale = function () {
return readJSON('scripts/app/i18n/resources-locale_en.json');
};
$httpBackend = $injector.get('$httpBackend');
$httpBackend.whenGET(/^scripts\/app\/i18n\/resources-locale_en.*$/).respond(getLocale());
$httpBackend.whenGET("/smartit/rest/v2/metadata?type=release").respond(200);
$httpBackend.whenGET("/smartit/rest/v2/metadata?type=activity").respond(200);
$httpBackend.whenGET('/smartit/rest/sessionstatus?getLicenseKey=true').respond(200);
$httpBackend.whenGET('/smartit/rest/serverstates').respond(200);
$httpBackend.whenGET('views/dashboard/index.html').respond(200);
$httpBackend.whenGET('/smartit/rest/relations/release/RLGAA5V0HGVEGAP6QML0P5TMNXXKOB?tags=releasePlan').respond(200);
rootScope = $rootScope;
scope = $rootScope.$new();
compile = $compile;
releaseTabIds = _releaseTabIds_;
}));
beforeEach(function () {
scope.tabIds = releaseTabIds;
scope.draftTicket = {
"type": "release",
"company": {
"name": "Calbro Services"
},
"location": {
"name": "Headquarters, Building 1.31"
},
"id": "RLGAA5V0HGVEGAP6QML0P5TMNXXKOB",
"displayId": "RLM000000000024",
"status": {}
};
});
function createDirective(model) {
var elem, compiledElem;
elem ='<release-plan-details></release-plan-details>';
compiledElem = compile(elem)(scope);
scope.$digest();
return compiledElem;
}
it('should compile releasePlanDetails directive', function () {
var ele = createDirective(), divElem = ele[0];
rootScope.$digest();
expect(divElem).toBeDefined();
});
});