Skip to content

Commit

Permalink
Skeleton for test
Browse files Browse the repository at this point in the history
Still not used and excluded from the build
  • Loading branch information
psychowood committed Dec 16, 2014
1 parent a35e5c9 commit b951bec
Show file tree
Hide file tree
Showing 9 changed files with 237 additions and 1 deletion.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ dist
.tmp
.sass-cache
bower_components
test
releases
36 changes: 36 additions & 0 deletions test/.jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"node": true,
"browser": true,
"esnext": true,
"bitwise": true,
"camelcase": true,
"curly": true,
"eqeqeq": true,
"immed": true,
"indent": 2,
"latedef": true,
"newcap": true,
"noarg": true,
"quotmark": "single",
"regexp": true,
"undef": true,
"unused": true,
"strict": true,
"trailing": true,
"smarttabs": true,
"globals": {
"after": false,
"afterEach": false,
"angular": false,
"before": false,
"beforeEach": false,
"browser": false,
"describe": false,
"expect": false,
"inject": false,
"it": false,
"jasmine": false,
"spyOn": false
}
}

75 changes: 75 additions & 0 deletions test/karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
// Karma configuration
// http://karma-runner.github.io/0.12/config/configuration-file.html
// Generated on 2014-10-17 using
// generator-karma 0.8.3

module.exports = function(config) {
'use strict';

config.set({
// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,

// base path, that will be used to resolve files and exclude
basePath: '../',

// testing framework to use (jasmine/mocha/qunit/...)
frameworks: ['jasmine'],

// list of files / patterns to load in the browser
files: [
'bower_components/angular/angular.js',
'bower_components/angular-mocks/angular-mocks.js',
'bower_components/angular-animate/angular-animate.js',
'bower_components/angular-cookies/angular-cookies.js',
'bower_components/angular-resource/angular-resource.js',
'bower_components/angular-route/angular-route.js',
'bower_components/angular-sanitize/angular-sanitize.js',
'bower_components/angular-touch/angular-touch.js',
'app/scripts/**/*.js',
'test/mock/**/*.js',
'test/spec/**/*.js'
],

// list of files / patterns to exclude
exclude: [],

// web server port
port: 8080,

// Start these browsers, currently available:
// - Chrome
// - ChromeCanary
// - Firefox
// - Opera
// - Safari (only Mac)
// - PhantomJS
// - IE (only Windows)
browsers: [
'PhantomJS'
],

// Which plugins to enable
plugins: [
'karma-phantomjs-launcher',
'karma-jasmine'
],

// Continuous Integration mode
// if true, it capture browsers, run tests and exit
singleRun: false,

colors: true,

// level of logging
// possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
logLevel: config.LOG_INFO,

// Uncomment the following lines if you are using grunt's server to run the tests
// proxies: {
// '/': 'http://localhost:9000/'
// },
// URL root prevent conflicts with the site root
// urlRoot: '_karma_'
});
};
22 changes: 22 additions & 0 deletions test/spec/controllers/about.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
'use strict';

describe('Controller: AboutCtrl', function () {

// load the controller's module
beforeEach(module('utorrentNgwebuiApp'));

var AboutCtrl,
scope;

// Initialize the controller and a mock scope
beforeEach(inject(function ($controller, $rootScope) {
scope = $rootScope.$new();
AboutCtrl = $controller('AboutCtrl', {
$scope: scope
});
}));

it('should attach a list of awesomeThings to the scope', function () {
expect(scope.awesomeThings.length).toBe(3);
});
});
22 changes: 22 additions & 0 deletions test/spec/controllers/details-dialog.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
'use strict';

describe('Controller: DetailsDialogCtrl', function () {

// load the controller's module
beforeEach(module('ngTorrentUiApp'));

var DetailsDialogCtrl,
scope;

// Initialize the controller and a mock scope
beforeEach(inject(function ($controller, $rootScope) {
scope = $rootScope.$new();
DetailsDialogCtrl = $controller('DetailsDialogCtrl', {
$scope: scope
});
}));

it('should attach a list of awesomeThings to the scope', function () {
expect(scope.awesomeThings.length).toBe(3);
});
});
22 changes: 22 additions & 0 deletions test/spec/controllers/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
'use strict';

describe('Controller: MainCtrl', function () {

// load the controller's module
beforeEach(module('utorrentNgwebuiApp'));

var MainCtrl,
scope;

// Initialize the controller and a mock scope
beforeEach(inject(function ($controller, $rootScope) {
scope = $rootScope.$new();
MainCtrl = $controller('MainCtrl', {
$scope: scope
});
}));

it('should attach a list of awesomeThings to the scope', function () {
expect(scope.awesomeThings.length).toBe(3);
});
});
22 changes: 22 additions & 0 deletions test/spec/controllers/settings.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
'use strict';

describe('Controller: SettingsCtrl', function () {

// load the controller's module
beforeEach(module('utorrentNgwebuiApp'));

var SettingsCtrl,
scope;

// Initialize the controller and a mock scope
beforeEach(inject(function ($controller, $rootScope) {
scope = $rootScope.$new();
SettingsCtrl = $controller('SettingsCtrl', {
$scope: scope
});
}));

it('should attach a list of awesomeThings to the scope', function () {
expect(scope.awesomeThings.length).toBe(3);
});
});
20 changes: 20 additions & 0 deletions test/spec/directives/torrent-status.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
'use strict';

describe('Directive: torrentStatus', function () {

// load the directive's module
beforeEach(module('utorrentNgwebuiApp'));

var element,
scope;

beforeEach(inject(function ($rootScope) {
scope = $rootScope.$new();
}));

it('should make hidden element visible', inject(function ($compile) {
element = angular.element('<torrent-status></torrent-status>');
element = $compile(element)(scope);
expect(element.text()).toBe('this is the torrentStatus directive');
}));
});
18 changes: 18 additions & 0 deletions test/spec/services/utorrentservice.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
'use strict';

describe('Service: uTorrentService', function () {

// load the service's module
beforeEach(module('utorrentNgwebuiApp'));

// instantiate service
var uTorrentService;
beforeEach(inject(function (_uTorrentService_) {
uTorrentService = _uTorrentService_;
}));

it('should do something', function () {
expect(!!uTorrentService).toBe(true);
});

});

0 comments on commit b951bec

Please sign in to comment.