Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1b7d69a

Browse files
committed
Added tests using mocha and chai
1 parent 11c5f1d commit 1b7d69a

File tree

7 files changed

+9463
-7
lines changed

7 files changed

+9463
-7
lines changed

Gruntfile.js

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,18 @@ module.exports = function(grunt) {
2222
}
2323
}
2424
},
25-
qunit: {
26-
files: ['tests/**/*.html']
25+
mocha: {
26+
all: {
27+
src: ['test/index.html'],
28+
options: {
29+
run: true,
30+
log: true
31+
// urls: ['http://<%= connect.test.options.hostname %>:<%= connect.test.options.port %>/index.html']
32+
}
33+
}
2734
},
2835
jshint: {
29-
files: ['Gruntfile.js', '*.js', 'tests/tests.js'],
36+
files: ['Gruntfile.js', 'ics.js', 'test/spec/test.js'],
3037
options: {
3138
// options here to override JSHint defaults
3239
globals: {
@@ -40,18 +47,18 @@ module.exports = function(grunt) {
4047
},
4148
watch: {
4249
files: ['<%= jshint.files %>'],
43-
tasks: ['jshint', 'qunit']
50+
tasks: ['jshint', 'mocha']
4451
}
4552
});
4653

4754
grunt.loadNpmTasks('grunt-contrib-uglify');
4855
grunt.loadNpmTasks('grunt-contrib-jshint');
49-
grunt.loadNpmTasks('grunt-contrib-qunit');
56+
grunt.loadNpmTasks('grunt-mocha');
5057
grunt.loadNpmTasks('grunt-contrib-watch');
5158
grunt.loadNpmTasks('grunt-contrib-concat');
5259

53-
grunt.registerTask('test', ['jshint', 'qunit']);
60+
grunt.registerTask('test', ['jshint', 'mocha']);
5461

55-
grunt.registerTask('default', ['jshint', 'qunit', 'concat', 'uglify']);
62+
grunt.registerTask('default', ['jshint', 'mocha', 'concat', 'uglify']);
5663

5764
};

test/index.html

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<!doctype html>
2+
<head>
3+
<meta charset="utf-8">
4+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
5+
<title>Mocha Spec Runner</title>
6+
<link rel="stylesheet" href="lib/mocha/mocha.css">
7+
</head>
8+
<body>
9+
<div id="mocha"></div>
10+
<script src="lib/mocha/mocha.js"></script>
11+
<script>mocha.setup('bdd')</script>
12+
<!-- assertion framework -->
13+
<script src="lib/chai.js"></script>
14+
<script>var assert = chai.assert</script>
15+
16+
<!-- include source files here... -->
17+
<script src="../ics.js"></script>
18+
<script>var cal = ics();</script>
19+
20+
<!-- include spec files here... -->
21+
<script src="spec/test.js"></script>
22+
23+
</body>
24+
</html>

0 commit comments

Comments
 (0)