30 lines
1.3 KiB
JavaScript
30 lines
1.3 KiB
JavaScript
/*** Created by npatil2.*/
|
|
describe('service: metadataService', function () {
|
|
var $httpBackend;
|
|
|
|
beforeEach(module('myitsmApp'));
|
|
beforeEach(inject(function ($injector, $location) {
|
|
this.$location = $location;
|
|
$httpBackend = $injector.get('$httpBackend');
|
|
$httpBackend.whenGET('scripts/app/i18n/resources-locale_en-US.json').respond(200);
|
|
$httpBackend.whenGET('/smartit/rest/serverstates').respond(200);
|
|
$httpBackend.whenGET('/smartit/rest/sessionstatus?getLicenseKey=true').respond(200);
|
|
$httpBackend.whenGET('views/dashboard/index.html').respond(200);
|
|
$rootScope = $injector.get('$rootScope');
|
|
this.metadataService = $injector.get('metadataService');
|
|
$httpBackend.expect('GET', '/smartit/rest/v2/metadata/').respond(200, 'success');
|
|
$httpBackend.expect('GET', '/smartit/rest/v2/metadata/person').respond(200, 'success');
|
|
}));
|
|
|
|
it('should defined', function () {
|
|
expect(this.metadataService).toBeDefined();
|
|
});
|
|
|
|
it('should getMetadataByType ()', function () {
|
|
this.type = 'test';
|
|
this.myResult = this.metadataService.getMetadataByType(this.type);
|
|
expect(this.myResult.$$state.status).toEqual(0);
|
|
this.myResult = this.metadataService.getPersonMetadata();
|
|
expect(this.myResult.$$state.status).toEqual(0);
|
|
});
|
|
}); |