Skip to content

Commit d30d592

Browse files
author
Miguel Garcia Lafuente
committed
Starting to build tests and real logic in the mock
1 parent bd804ea commit d30d592

File tree

9 files changed

+671
-50
lines changed

9 files changed

+671
-50
lines changed

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
bower_components/
2+
src/lib/
3+
node_modules/
4+
bower_components
5+
src/bower_components/
6+
src/lib/
7+
build/
8+
_SpecRunner.html
9+
.grunt/
10+
src/js/.tern-port

.jscsrc

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
{
2+
"validateIndentation": 4,
3+
"validateLineBreaks": "LF",
4+
"validateParameterSeparator": ", ",
5+
"disallowEmptyBlocks": true,
6+
"disallowKeywordsOnNewLine": ["else"],
7+
"disallowTrailingWhitespace": true,
8+
"disallowMixedSpacesAndTabs": true,
9+
"disallowNewlineBeforeBlockStatements": true,
10+
"disallowFunctionDeclarations": true,
11+
"disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"],
12+
"disallowSpaceBeforePostfixUnaryOperators": ["++", "--"],
13+
"disallowSpacesInsideArrayBrackets": true,
14+
"disallowSpacesInsideObjectBrackets": true,
15+
"disallowSpacesInsideParentheses": true,
16+
"disallowSpaceAfterObjectKeys": true,
17+
"requireCapitalizedConstructors": true,
18+
"requireDotNotation": true,
19+
"requireSpacesInConditionalExpression": true,
20+
"requireSpaceBeforeObjectValues": true,
21+
"requireSpaceBeforeBlockStatements": true,
22+
"requireSpaceBeforeBinaryOperators": [
23+
"+",
24+
"-",
25+
"/",
26+
"*",
27+
"=",
28+
"==",
29+
"===",
30+
"!=",
31+
"!==",
32+
"<",
33+
"<=",
34+
">",
35+
"=>"
36+
],
37+
"requireSpaceAfterBinaryOperators": [
38+
"+",
39+
"-",
40+
"/",
41+
"*",
42+
"=",
43+
"==",
44+
"===",
45+
"!=",
46+
"!==",
47+
"<",
48+
"<=",
49+
">",
50+
"=>",
51+
","
52+
],
53+
"requireSpaceAfterKeywords": [
54+
"do",
55+
"for",
56+
"if",
57+
"else",
58+
"switch",
59+
"case",
60+
"try",
61+
"catch",
62+
"void",
63+
"while",
64+
"with",
65+
"return",
66+
"typeof",
67+
"function"
68+
],
69+
"requireSpacesInAnonymousFunctionExpression": {
70+
"beforeOpeningRoundBrace": true,
71+
"beforeOpeningCurlyBrace": true
72+
},
73+
"requireCurlyBraces": [
74+
"if",
75+
"else",
76+
"for",
77+
"while",
78+
"do",
79+
"try",
80+
"catch",
81+
"switch"
82+
]
83+
}

.jshintrc

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
{
2-
"curly": true,
3-
"eqeqeq": true,
4-
"immed": true,
5-
"latedef": true,
6-
"newcap": true,
7-
"noarg": true,
8-
"sub": true,
9-
"undef": true,
10-
"boss": true,
11-
"eqnull": true,
12-
"node": true,
13-
"esnext": true
2+
"jasmine": true,
3+
"browser": true,
4+
"debug": false,
5+
"devel": false,
6+
"curly": true,
7+
"eqnull": true,
8+
"forin": false,
9+
"undef": true,
10+
"unused": "vars",
11+
"indent": 4,
12+
"prototypejs": false,
13+
"strict": true,
14+
"trailing": true,
15+
"white": true,
16+
"globals": {
17+
"URL": false
18+
}
1419
}

.jshintrc-jasmine

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"jasmine": true,
3+
"browser": true,
4+
"debug": false,
5+
"devel": false,
6+
"eqnull": true,
7+
"forin": false,
8+
"undef": true,
9+
"unused": false,
10+
"prototypejs": false,
11+
"globalstrict": false,
12+
"strict": true,
13+
"white": false,
14+
"quotmark": false,
15+
"globals": {
16+
"URL": false,
17+
"MashupPlatform": true,
18+
"Widget": true,
19+
"MyStrategy": true,
20+
"MockServer": true,
21+
"MockSocket": true
22+
}
23+
}

.jshintrc-node

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"node": true,
3+
"debug": false,
4+
"devel": false,
5+
"curly": true,
6+
"eqnull": true,
7+
"forin": false,
8+
"undef": true,
9+
"unused": "vars",
10+
"strict": true
11+
}

Gruntfile.js

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
/*!
2+
* Copyright 2014-2015 CoNWeT Lab., Universidad Politecnica de Madrid
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
18+
module.exports = function (grunt) {
19+
20+
'use strict';
21+
22+
grunt.initConfig({
23+
24+
pkg: grunt.file.readJSON('package.json'),
25+
26+
bower: {
27+
install: {
28+
options: {
29+
layout: function (type, component, source) {
30+
return type;
31+
},
32+
targetDir: './build/lib/lib'
33+
}
34+
}
35+
},
36+
37+
jscs: {
38+
src: 'lib/**/*',
39+
options: {
40+
config: ".jscsrc"
41+
}
42+
},
43+
44+
jshint: {
45+
options: {
46+
jshintrc: true
47+
},
48+
all: {
49+
files: {
50+
src: ['lib/**/*.js']
51+
}
52+
},
53+
grunt: {
54+
options: {
55+
jshintrc: '.jshintrc-node'
56+
},
57+
files: {
58+
src: ['Gruntfile.js']
59+
}
60+
},
61+
test: {
62+
options: {
63+
jshintrc: '.jshintrc-jasmine'
64+
},
65+
files: {
66+
src: ['test/**/*.js', '!test/fixtures/']
67+
}
68+
}
69+
},
70+
71+
jasmine: {
72+
test:{
73+
src: ['lib/**/*.js'],
74+
options: {
75+
specs: 'test/js/*Spec.js',
76+
helpers: ['test/helpers/*.js'],
77+
vendor: ['test/vendor/*.js']
78+
}
79+
},
80+
coverage: {
81+
src: '<%= jasmine.test.src %>',
82+
options: {
83+
helpers: '<%= jasmine.test.options.helpers %>',
84+
specs: '<%= jasmine.test.options.specs %>',
85+
vendor: '<%= jasmine.test.options.vendor %>',
86+
template: require('grunt-template-jasmine-istanbul'),
87+
templateOptions : {
88+
coverage: 'build/coverage/json/coverage.json',
89+
report: [
90+
{type: 'html', options: {dir: 'build/coverage/html'}},
91+
{type: 'cobertura', options: {dir: 'build/coverage/xml'}},
92+
{type: 'text-summary'}
93+
]
94+
}
95+
}
96+
}
97+
}
98+
99+
});
100+
101+
grunt.loadNpmTasks('grunt-bower-task');
102+
grunt.loadNpmTasks('grunt-contrib-jasmine');
103+
grunt.loadNpmTasks('grunt-contrib-jshint');
104+
grunt.loadNpmTasks('grunt-jscs');
105+
106+
grunt.registerTask('install', 'bower:install');
107+
grunt.registerTask('static', ['jshint:grunt', 'jshint', 'jscs']);
108+
grunt.registerTask('test_t', 'jasmine:coverage');
109+
110+
grunt.registerTask('test', ['install', 'static', 'test_t']);
111+
112+
// grunt.registerTask('deploy', ['test',
113+
// 'clean_tmp', 'mcopy', 'strip_code',
114+
// 'version', 'zip']); // Maybe clean_tmp at the end again?
115+
116+
grunt.registerTask('default', 'test');
117+
};

0 commit comments

Comments
 (0)