Permalink
Browse files

Refactor unit tests

  • Loading branch information...
1 parent 0e4ce9e commit 28aa36a9372359f674a15b3c345ba48c257809dc @mrako committed Jun 24, 2014
Showing with 37 additions and 60 deletions.
  1. +4 −2 Gruntfile.js
  2. +0 −56 karma.conf.js
  3. +2 −2 public/templates/todos.html
  4. +31 −0 test/karma.conf.js
View
@@ -39,15 +39,17 @@ module.exports = function(grunt) {
},
karma: {
unit: {
- configFile: 'karma.conf.js',
- singleRun: true
+ configFile: './test/karma.conf.js'
}
}
});
grunt.registerTask('server', ['express:dev', 'open', 'watch']);
grunt.registerTask('default', ['jshint', 'karma']);
+ grunt.registerTask('test:unit', ['karma:unit']);
+ grunt.registerTask('test:e2e', ['karma:e2e']);
+
grunt.loadNpmTasks('grunt-express-server');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-open');
View
@@ -1,56 +0,0 @@
-// Karma configuration
-// http://karma-runner.github.io/0.10/config/configuration-file.html
-
-module.exports = function(config) {
- config.set({
- // 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: [
- 'public/components/angular/angular.js',
- 'public/components/angular-route/angular-route.js',
- 'public/components/angular-xeditable/dist/js/xeditable.js',
- 'public/components/angular-route/angular-route.js',
- 'public/components/angular-mocks/angular-mocks.js',
- 'public/js/app.js',
- 'public/js/services/todos_service.js',
- 'public/js/controllers/todos_controller.js',
- 'test/spec/**/*.js'
- ],
-
- // list of files / patterns to exclude
- exclude: [],
-
- // web server port
- port: 9001,
-
- // level of logging
- // possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
- logLevel: config.LOG_INFO,
-
- reporters : ['spec'],
-
- // enable / disable watching file and executing tests whenever any file changes
- autoWatch: false,
-
-
- // Start these browsers, currently available:
- // - Chrome
- // - ChromeCanary
- // - Firefox
- // - Opera
- // - Safari (only Mac)
- // - PhantomJS
- // - IE (only Windows)
- browsers: ['PhantomJS'],
-
-
- // Continuous Integration mode
- // if true, it capture browsers, run tests and exit
- singleRun: false
- });
-};
@@ -1,4 +1,4 @@
-<div ng-controller="TodosController">
+<div id="todos" ng-controller="TodosController">
<div class="jumbotron">
<h3>You currently have <ng-pluralize count="todos.length" when="{'0': 'no todos', '1': '1 todo', 'other': '{} todos'}" /></h3>
@@ -9,7 +9,7 @@
<form ng-submit="save()" class="form-inline" role="form">
<div class="form-group">
<label class="sr-only" for="text">Todo</label>
- <input type="text" name="text" ng-model="formData.text" class="form-control" id="text" placeholder="New todo item">
+ <input type="text" name="text" ng-model="formData.text" class="form-control" placeholder="New todo item">
</div>
<input type="hidden" ng-model="formData._id" />
<button type="submit" class="btn btn-info"/>{{ submit }}</button>
View
@@ -0,0 +1,31 @@
+module.exports = function(config) {
+ config.set({
+ basePath: '../',
+
+ frameworks: ['jasmine'],
+
+ files: [
+ 'public/components/angular/angular.js',
+ 'public/components/angular-route/angular-route.js',
+ 'public/components/angular-xeditable/dist/js/xeditable.js',
+ 'public/components/angular-route/angular-route.js',
+ 'public/components/angular-mocks/angular-mocks.js',
+ 'public/js/app.js',
+ 'public/js/services/todos_service.js',
+ 'public/js/controllers/todos_controller.js',
+ 'test/spec/**/*.js'
+ ],
+
+ exclude: [],
+
+ port: 9999,
+
+ reporters : ['spec'],
+
+ autoWatch: false,
+
+ browsers: ['PhantomJS'],
+
+ singleRun: true
+ });
+};

0 comments on commit 28aa36a

Please sign in to comment.