42 lines
1.2 KiB
JavaScript
42 lines
1.2 KiB
JavaScript
describe('Testing favoriteService', function () {
|
|
'use strict';
|
|
|
|
var $httpBackend;
|
|
|
|
beforeEach(module('myitsmApp'));
|
|
beforeEach(inject(function (_favoriteService_, _$resource_, _$httpBackend_) {
|
|
this.favoriteService = _favoriteService_;
|
|
this.$resource = _$resource_;
|
|
$httpBackend = _$httpBackend_;
|
|
|
|
var getLocale = function () {
|
|
return readJSON('scripts/app/i18n/resources-locale_en.json');
|
|
};
|
|
$httpBackend.whenGET(/^scripts\/app\/i18n\/resources-locale_en.*$/).respond(getLocale());
|
|
}));
|
|
|
|
it('should exist', function () {
|
|
expect(this.favoriteService).toBeDefined();
|
|
});
|
|
|
|
it('should run addFavorite ()', function () {
|
|
this.items = {
|
|
id: 123,
|
|
type: 'test foo'
|
|
};
|
|
this.myResult = this.favoriteService.addFavorite(this.items);
|
|
expect(this.myResult.$$state.status).toEqual(0);
|
|
});
|
|
|
|
it('should run removeFavorite()', function () {
|
|
this.items = {
|
|
attributeValueMap: function () {
|
|
return;
|
|
}
|
|
};
|
|
this.myResult = this.favoriteService.removeFavorite(this.items);
|
|
expect(this.myResult.$$state.status).toEqual(0);
|
|
});
|
|
});
|
|
|