added jshint to the grunt config files as well as the test files.

This commit is contained in:
Spencer Alger 2014-03-03 14:57:47 -07:00
parent d5ae35c3ad
commit 8442ac301c
6 changed files with 28 additions and 17 deletions

View file

@ -33,5 +33,6 @@
"sub": true,
"maxlen": 140,
"-W084": true,
"maxerr": 10
}
"maxerr": 10,
"scripturl": true
}

View file

@ -1,13 +1,13 @@
module.exports = function(config) {
module.exports = function (config) {
return {
// just lint the source dir
source: {
files: {
src: ['Gruntfile.js', '<%= root %>/src/**/*.js']
src: ['Gruntfile.js', '<%= src %>/**/*.js', '<%= unitTestDir %>/**/*.js', '<%= root %>/tasks/**/*.js']
}
},
options: {
jshintrc: '<%= root %>/.jshintrc',
jshintrc: true,
ignores: [
'node_modules/*',
'dist/*',

View file

@ -1,6 +1,7 @@
module.exports = function (grunt) {
/* jshint scripturl:true */
grunt.registerTask('test', [
'jshint',
'connect:test',
'jade:test',
'mocha:unit'

View file

@ -0,0 +1,18 @@
define(function (require) {
return {
test: {
mappings: {
testType: {
'foo.bar': {
full_name: 'foo.bar',
mapping: {
bar: {
type: 'string'
}
}
}
}
}
}
};
});

View file

@ -14,7 +14,7 @@
}
}
});
require(["/specs/apps/dashboard/index.js","/specs/calculate_indices.js","/specs/courier.js","/specs/data_source.js","/specs/mapper.js"], function () {
require(["/fixtures/field_mapping.js","/specs/calculate_indices.js","/specs/courier.js","/specs/data_source.js","/specs/mapper.js"], function () {
window.mochaRunner = mocha.run().on('end', function () {
window.mochaResults = this.stats;
});

View file

@ -5,6 +5,7 @@ define(function (require) {
var Courier = require('courier/courier');
var DataSource = require('courier/data_source/data_source');
var Mapper = require('courier/mapper');
var fieldMapping = require('../fixtures/field_mapping.js');
var client = new elasticsearch.Client({
host: 'localhost:9200',
@ -26,17 +27,7 @@ define(function (require) {
// Stub out a mini mapping response.
sinon.stub(client.indices, 'getFieldMapping',function (params, callback) {
if(params.index === 'valid') {
setTimeout(callback(undefined,{
test: {
mappings: {
testType: {
'foo.bar': {
full_name: 'foo.bar',
mapping: {
bar: {
type: 'string'
} } } } } } }
),0);
setTimeout(callback(undefined, fieldMapping),0);
} else {
setTimeout(callback('Error: Not Found',undefined));
}