Skip to content

Commit

Permalink
Added tests using mocha and chai
Browse files Browse the repository at this point in the history
  • Loading branch information
khornberg committed Dec 5, 2013
1 parent 11c5f1d commit 1b7d69a
Show file tree
Hide file tree
Showing 7 changed files with 9,463 additions and 7 deletions.
21 changes: 14 additions & 7 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,18 @@ module.exports = function(grunt) {
}
}
},
qunit: {
files: ['tests/**/*.html']
mocha: {
all: {
src: ['test/index.html'],
options: {
run: true,
log: true
// urls: ['http://<%= connect.test.options.hostname %>:<%= connect.test.options.port %>/index.html']
}
}
},
jshint: {
files: ['Gruntfile.js', '*.js', 'tests/tests.js'],
files: ['Gruntfile.js', 'ics.js', 'test/spec/test.js'],
options: {
// options here to override JSHint defaults
globals: {
Expand All @@ -40,18 +47,18 @@ module.exports = function(grunt) {
},
watch: {
files: ['<%= jshint.files %>'],
tasks: ['jshint', 'qunit']
tasks: ['jshint', 'mocha']
}
});

grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.loadNpmTasks('grunt-mocha');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-concat');

grunt.registerTask('test', ['jshint', 'qunit']);
grunt.registerTask('test', ['jshint', 'mocha']);

grunt.registerTask('default', ['jshint', 'qunit', 'concat', 'uglify']);
grunt.registerTask('default', ['jshint', 'mocha', 'concat', 'uglify']);

};
24 changes: 24 additions & 0 deletions test/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!doctype html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Mocha Spec Runner</title>
<link rel="stylesheet" href="lib/mocha/mocha.css">
</head>
<body>
<div id="mocha"></div>
<script src="lib/mocha/mocha.js"></script>
<script>mocha.setup('bdd')</script>
<!-- assertion framework -->
<script src="lib/chai.js"></script>
<script>var assert = chai.assert</script>

<!-- include source files here... -->
<script src="../ics.js"></script>
<script>var cal = ics();</script>

<!-- include spec files here... -->
<script src="spec/test.js"></script>

</body>
</html>
Loading

0 comments on commit 1b7d69a

Please sign in to comment.