Skip to content

Instantly share code, notes, and snippets.

@charandas
Last active August 29, 2015 14:02
Show Gist options
  • Save charandas/eb96cd89f49a8739b644 to your computer and use it in GitHub Desktop.
Save charandas/eb96cd89f49a8739b644 to your computer and use it in GitHub Desktop.
Tests for app states module
define([
'angularMocks',
'core/modules/states/app'
], function () {
'use strict';
describe('core.states.app spec', function () {
var $rootScope, $state, $injector, settingsShimService;
// So we don't use actual a and b state modules
angular.mock.module('core.states.a', []);
angular.mock.module('core.states.b', []);
beforeEach(
module(
'core.states.app',
'core.states.a',
'core.states.b',
function($provide) {
$provide.value('SettingsService', settingsService = {});
settingsService.get = jasmine.createSpy('get').andReturn($promise: 'settings-all');
}
)
);
beforeEach(inject(function(_$rootScope_, _$state_, _$injector_, $templateCache) {
$rootScope = _$rootScope_;
$injector = _$injector_;
$state = _$state_;
$templateCache.put('views/app.html', '');
}));
describe('app abstract', function() {
var state = 'app';
it('verify state configuration', function() {
var config = $state.get(state);
expect(config.abstract).toBeTruthy();
expect(config.url).toBeUndefined();
expect($injector.invoke(config.resolve.settings)).toBe('settings-all');
});
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment