35 lines
1.3 KiB
JavaScript
35 lines
1.3 KiB
JavaScript
describe('Testing srd-service', function () {
|
|
'use strict';
|
|
|
|
var $httpBackend;
|
|
|
|
beforeEach(module('myitsmApp'));
|
|
beforeEach(inject(function (_srdService_, _$resource_, _$httpBackend_, $rootScope, $q) {
|
|
this.srdService = _srdService_;
|
|
this.$resource = _$resource_;
|
|
$httpBackend = _$httpBackend_;
|
|
this.scope = $rootScope.$new();
|
|
var getLocale = function () {
|
|
return readJSON('scripts/app/i18n/resources-locale_en.json');
|
|
};
|
|
$httpBackend.whenGET(/^scripts\/app\/i18n\/resources-locale_en.*$/).respond(getLocale());
|
|
$httpBackend.whenGET('/smartit/rest/serverstates').respond(200);
|
|
$httpBackend.whenGET('/smartit/rest/sessionstatus?getLicenseKey=true').respond(200);
|
|
$httpBackend.whenGET('views/dashboard/index.html').respond(200);
|
|
$httpBackend.whenGET('/smartit/rest/request/requestobo/1234/12122').respond(200);
|
|
}));
|
|
|
|
it('should exist', function () {
|
|
expect(this.srdService).toBeDefined();
|
|
});
|
|
|
|
it('should run getRequestOnBehalfOf ()', function () {
|
|
this.customerId = 1234;
|
|
this.contactId = 12122;
|
|
this.myResult = this.srdService.getRequestOnBehalfOf(this.customerId, this.contactId);
|
|
this.scope.$apply();
|
|
expect(this.myResult.$$state.status).toEqual(0);
|
|
});
|
|
});
|
|
|