Skip to content
This repository has been archived by the owner on Jun 16, 2018. It is now read-only.

Commit

Permalink
Added basic smoke testing for settings controller
Browse files Browse the repository at this point in the history
  • Loading branch information
rikkertkoppes committed Jul 13, 2014
1 parent c97f7be commit 01a0ae2
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 1 deletion.
47 changes: 47 additions & 0 deletions spec/views/settingsSpec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
describe('teams', function() {

var module = factory('views/settings', {
'services/log': logMock
});

var $scope, controller;

var fsMock = createFsMock('settigns');

beforeEach(function() {
angular.mock.module(module.name);
angular.mock.inject(function($controller, $rootScope) {
$scope = $rootScope.$new();
controller = $controller('settingsCtrl', {
'$scope': $scope,
'$fs': fsMock
});
});
});

describe('initialization', function() {
it('should initialize', function() {
//TODO: check state after reading
});

});

describe('missing settings.json on storage',function() {
beforeEach(function() {
fsMock.read = jasmine.createSpy('fsReadSpy').andCallFake(function() {
return Q.reject('no file found');
});
})
it('should initialize in editmode when no teams found on storage', function() {
//TODO: check state after reading
});
});

describe('saving',function() {
it('should write to the file system',function() {
$scope.settings = 'data';
$scope.save();
expect(fsMock.write).toHaveBeenCalledWith('settings.json','data');
});
});
});
2 changes: 1 addition & 1 deletion src/js/views/settings.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
define([
define('views/settings',[
'services/log',
'services/ng-fs',
'angular'
Expand Down

0 comments on commit 01a0ae2

Please sign in to comment.