SmartIT_Extensions/BMC/smart-it-full/test/app/common/follow-service.spec.js

39 lines
1.1 KiB
JavaScript

describe('Testing followService', function () {
'use strict';
var $httpBackend;
beforeEach(module('myitsmApp'));
beforeEach(inject(function (_followService_, _$resource_, _$httpBackend_) {
this.followService = _followService_;
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.followService).toBeDefined();
});
it('should run follow ()', function () {
this.items = {
id: 123,
type: 'test foo'
};
this.myResult = this.followService.follow(this.items);
expect(this.myResult.$$state.status).toEqual(0);
});
it('should run unfollow ()', function () {
this.items = 'test foo';
this.myResult = this.followService.unfollow(this.items);
expect(this.myResult.$$state.status).toEqual(0);
});
});