1
0
mirror of https://github.com/chylex/Nextcloud-News.git synced 2024-11-22 16:42:47 +01:00
Nextcloud-News/js/tests/unit/controller/AppControllerSpec.js
2016-07-23 21:32:42 +02:00

57 lines
1.3 KiB
JavaScript

/**
* Nextcloud - News
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Bernhard Posselt <dev@bernhard-posselt.com>
* @copyright Bernhard Posselt 2014
*/
describe('AppController', function () {
'use strict';
var controller,
location;
beforeEach(module('News', function ($provide) {
$provide.value('BASE_URL', 'base');
}));
beforeEach(inject(function ($controller) {
location = {
path: jasmine.createSpy('path')
};
controller = $controller('AppController', {
$location: location
});
}));
it('should expose Loading', inject(function (Loading) {
expect(controller.loading).toBe(Loading);
}));
it('should expose set firstrun if no feeds and folders', function () {
expect(controller.isFirstRun()).toBe(true);
});
it('should expose set firstrun if feeds', inject(function (FeedResource) {
FeedResource.add({url: 'test'});
expect(controller.isFirstRun()).toBe(false);
}));
it('should expose set firstrun if folders', inject(
function (FolderResource) {
FolderResource.add({name: 'test'});
expect(controller.isFirstRun()).toBe(false);
expect(location.path).not.toHaveBeenCalled();
}));
});