From 8d2596335f9d6e6467e23cf4e6af599bb1497e3d Mon Sep 17 00:00:00 2001 From: Brandon Cox Date: Sun, 14 Aug 2016 17:04:53 -0400 Subject: [PATCH] Added the files needed to be able to run a simple even/odd unit test to exec jenkins step against --- dc-metro-map/Gruntfile.js | 55 ++++++++++++++++++++++++++ dc-metro-map/README-dev.md | 6 +++ dc-metro-map/package.json | 6 +++ dc-metro-map/test/dc-metro-map_test.js | 9 +++++ 4 files changed, 76 insertions(+) create mode 100644 dc-metro-map/Gruntfile.js create mode 100644 dc-metro-map/test/dc-metro-map_test.js diff --git a/dc-metro-map/Gruntfile.js b/dc-metro-map/Gruntfile.js new file mode 100644 index 00000000..0bb48870 --- /dev/null +++ b/dc-metro-map/Gruntfile.js @@ -0,0 +1,55 @@ + +/*global module:false*/ +module.exports = function(grunt) { + + // Project configuration. + grunt.initConfig({ + // Task configuration. + jshint: { + options: { + curly: true, + eqeqeq: true, + immed: true, + latedef: true, + newcap: true, + noarg: true, + sub: true, + undef: true, + unused: true, + boss: true, + eqnull: true, + globals: { + jQuery: true + } + }, + gruntfile: { + src: 'Gruntfile.js' + }, + lib_test: { + src: ['lib/**/*.js', 'test/**/*.js'] + } + }, + nodeunit: { + files: ['test/**/*_test.js'] + }, + watch: { + gruntfile: { + files: '<%= jshint.gruntfile.src %>', + tasks: ['jshint:gruntfile'] + }, + lib_test: { + files: '<%= jshint.lib_test.src %>', + tasks: ['jshint:lib_test', 'nodeunit'] + } + } + }); + + // These plugins provide necessary tasks. + grunt.loadNpmTasks('grunt-contrib-nodeunit'); + grunt.loadNpmTasks('grunt-contrib-jshint'); + grunt.loadNpmTasks('grunt-contrib-watch'); + + // Default task. + grunt.registerTask('default', ['jshint', 'nodeunit']); + +}; \ No newline at end of file diff --git a/dc-metro-map/README-dev.md b/dc-metro-map/README-dev.md index 427f56e3..3cc8d133 100644 --- a/dc-metro-map/README-dev.md +++ b/dc-metro-map/README-dev.md @@ -16,6 +16,12 @@ You can see the results of a full query in the file exampledata.json ### Environment Variables You can have some fun by setting a couple different environment variables. Try BEERME=true and/or RAINBOW=true. +### Usage + npm install; npm start + +### Run nodeunit tests + grunt nodeunit + Thanks for reading! - Dudash diff --git a/dc-metro-map/package.json b/dc-metro-map/package.json index 4ce2c3dc..ac3b4aaf 100644 --- a/dc-metro-map/package.json +++ b/dc-metro-map/package.json @@ -14,5 +14,11 @@ "morgan": "~1.6.1", "restler": "~3.4.0", "serve-favicon": "~2.3.0" + }, + "devDependencies": { + "grunt": "~0.4.5", + "grunt-contrib-jshint": "~0.10.0", + "grunt-contrib-nodeunit": "~0.4.1", + "grunt-contrib-uglify": "~0.5.0" } } \ No newline at end of file diff --git a/dc-metro-map/test/dc-metro-map_test.js b/dc-metro-map/test/dc-metro-map_test.js new file mode 100644 index 00000000..71c9cb86 --- /dev/null +++ b/dc-metro-map/test/dc-metro-map_test.js @@ -0,0 +1,9 @@ +// This test only passes if the current system time is a odd minute +exports.passOnOddMinute = function(test) { + + var date = new Date(); + var minutes = date.getMinutes(); + + test.ok(minutes % 2 === 1, "this assertion should pass"); + test.done(); +};