Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add dummy unittests for scaffold and karma config.
refs #724
- Loading branch information
1 parent
754c377
commit 424d4bf
Showing
2 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
opal/scaffolding/scaffold/app/static/js/tests/test.routes.js
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,33 @@ | ||
// | ||
// Unittests for the application router | ||
// | ||
|
||
describe('Routes', function() { | ||
"use strict"; | ||
|
||
var $route; | ||
|
||
beforeEach(function(){ | ||
|
||
module('opal'); | ||
|
||
inject(function($injector){ | ||
$route = $injector.get('$route'); | ||
}) | ||
}); | ||
|
||
describe('/', function() { | ||
|
||
it('should direct to the welcome controller', function() { | ||
var controller = $route.routes['/'].controller; | ||
expect('WelcomeCtrl').toEqual(controller); | ||
}); | ||
|
||
it('should use the welcome template', function() { | ||
var controller = $route.routes['/'].templateUrl; | ||
expect('/templates/welcome.html').toEqual(controller); | ||
}); | ||
|
||
}); | ||
|
||
}); |
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,23 @@ | ||
// config/karma.config.js | ||
|
||
module.exports = function(config){ | ||
var opalPath = process.env.OPAL_LOCATION; | ||
|
||
var karmaDefaults = require(opalPath + '/opal/tests/js_config/karma_defaults.js'); | ||
var baseDir = __dirname + '/..'; | ||
|
||
var coverageFiles = [ | ||
__dirname + '/../{{ name }}/static/js/{{ name }}/*', | ||
// Add code to include on test runs here ... | ||
]; | ||
|
||
var includedFiles = [ | ||
'opal/app.js', | ||
|
||
// Add test cases here | ||
__dirname + '/../{{ name }}/static/js/tests/*.js', | ||
].concat(coverageFiles); | ||
|
||
var defaultConfig = karmaDefaults(includedFiles, baseDir, coverageFiles); | ||
config.set(defaultConfig); | ||
}; |