This repository has been archived by the owner on Jun 16, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added basic smoke testing for settings controller
- Loading branch information
1 parent
c97f7be
commit 01a0ae2
Showing
2 changed files
with
48 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
define([ | ||
define('views/settings',[ | ||
'services/log', | ||
'services/ng-fs', | ||
'angular' | ||
|