mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
add unit test to build process
This commit is contained in:
@@ -132,6 +132,11 @@ module.exports = function(grunt) {
|
|||||||
watch: {
|
watch: {
|
||||||
files: ['libs/*.js', 'src/*.js', 'src/*.css', 'Gruntfile.js'],
|
files: ['libs/*.js', 'src/*.js', 'src/*.css', 'Gruntfile.js'],
|
||||||
tasks: ['concat', 'uglify', 'cssmin']
|
tasks: ['concat', 'uglify', 'cssmin']
|
||||||
|
},
|
||||||
|
qunit: {
|
||||||
|
files: [
|
||||||
|
'test/jquery.gridster.html'
|
||||||
|
]
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -142,6 +147,7 @@ module.exports = function(grunt) {
|
|||||||
grunt.loadNpmTasks('grunt-contrib-concat');
|
grunt.loadNpmTasks('grunt-contrib-concat');
|
||||||
grunt.loadNpmTasks('grunt-contrib-uglify');
|
grunt.loadNpmTasks('grunt-contrib-uglify');
|
||||||
grunt.loadNpmTasks('grunt-contrib-cssmin');
|
grunt.loadNpmTasks('grunt-contrib-cssmin');
|
||||||
|
grunt.loadNpmTasks('grunt-contrib-qunit');
|
||||||
grunt.loadNpmTasks('grunt-contrib-yuidoc');
|
grunt.loadNpmTasks('grunt-contrib-yuidoc');
|
||||||
grunt.loadNpmTasks('grunt-bump');
|
grunt.loadNpmTasks('grunt-bump');
|
||||||
grunt.loadNpmTasks('grunt-conventional-changelog');
|
grunt.loadNpmTasks('grunt-conventional-changelog');
|
||||||
@@ -149,7 +155,8 @@ module.exports = function(grunt) {
|
|||||||
|
|
||||||
// Default task.
|
// Default task.
|
||||||
grunt.registerTask('default', ['jshint', 'concat', 'uglify', 'cssmin']);
|
grunt.registerTask('default', ['jshint', 'concat', 'uglify', 'cssmin']);
|
||||||
grunt.registerTask('build', ['default']);
|
grunt.registerTask('build', ['default', 'qunit']);
|
||||||
|
grunt.registerTask('test', ['jshint','qunit']);
|
||||||
grunt.registerTask('docs', ['clean', 'build', 'yuidoc', 'copy:dist', 'gh-pages']);
|
grunt.registerTask('docs', ['clean', 'build', 'yuidoc', 'copy:dist', 'gh-pages']);
|
||||||
|
|
||||||
grunt.registerTask('release:patch', ['build', 'bump-only:patch', 'build', 'docs', 'changelog']);
|
grunt.registerTask('release:patch', ['build', 'bump-only:patch', 'build', 'docs', 'changelog']);
|
||||||
|
@@ -30,6 +30,7 @@
|
|||||||
"grunt-contrib-copy": "^0.8.0",
|
"grunt-contrib-copy": "^0.8.0",
|
||||||
"grunt-contrib-cssmin": "~0.10.0",
|
"grunt-contrib-cssmin": "~0.10.0",
|
||||||
"grunt-contrib-jshint": "~0.10.0",
|
"grunt-contrib-jshint": "~0.10.0",
|
||||||
|
"grunt-contrib-qunit": "^0.7.0",
|
||||||
"grunt-contrib-uglify": "~0.6.0",
|
"grunt-contrib-uglify": "~0.6.0",
|
||||||
"grunt-contrib-watch": "~0.6.1",
|
"grunt-contrib-watch": "~0.6.1",
|
||||||
"grunt-contrib-yuidoc": "~0.7.0",
|
"grunt-contrib-yuidoc": "~0.7.0",
|
||||||
|
@@ -305,12 +305,17 @@
|
|||||||
equal(grid.is_responsive(), true);
|
equal(grid.is_responsive(), true);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Gridster.sort_by_row_asc', function (assert) {
|
test('Gridster.sort_by_row_asc', 4, function (assert) {
|
||||||
var sorted = Gridster.sort_by_row_asc(this.serialization);
|
var sorted = Gridster.sort_by_row_asc(this.serialization);
|
||||||
|
|
||||||
var result = pickup(sorted, 'name').join(',');
|
var result = pickup(sorted, 'name').join(',');
|
||||||
var expected = 'A,B,D,E,C';
|
var expected = 'A,B,D,E,C';
|
||||||
assert.equal(result, expected);
|
//since the test data contains 3 #1, they could be in any order
|
||||||
|
ok( result.substring(0,5).indexOf('A') > -1, 'A is found in within the first 3 results');
|
||||||
|
ok( result.substring(0,5).indexOf('B') > -1, 'B is found in within the first 3 results');
|
||||||
|
ok( result.substring(0,5).indexOf('D') > -1, 'D is found in within the first 3 results');
|
||||||
|
//check the last to chars
|
||||||
|
equal( result.substring(6), expected.substring(6), 'E,C are the last two - In that order');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Gridster.sort_by_row_and_col_asc', function (assert) {
|
test('Gridster.sort_by_row_and_col_asc', function (assert) {
|
||||||
@@ -329,12 +334,17 @@
|
|||||||
assert.equal(result, expected);
|
assert.equal(result, expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Gridster.sort_by_row_desc', function (assert) {
|
test('Gridster.sort_by_row_desc',4, function (assert) {
|
||||||
var sorted = Gridster.sort_by_row_desc(this.serialization);
|
var sorted = Gridster.sort_by_row_desc(this.serialization);
|
||||||
|
|
||||||
var result = pickup(sorted, 'name').join(',');
|
var result = pickup(sorted, 'name').join(',');
|
||||||
var expected = 'C,E,A,B,D';
|
var expected = 'C,E,A,B,D';
|
||||||
assert.equal(result, expected);
|
//since the test data contains 3 #1, they could be in any order
|
||||||
|
ok( result.substring(4).indexOf('A') > -1, 'A is found in within the last 3 results');
|
||||||
|
ok( result.substring(4).indexOf('B') > -1, 'B is found in within the last 3 results');
|
||||||
|
ok( result.substring(4).indexOf('D') > -1, 'D is found in within the last 3 results');
|
||||||
|
//check the last to chars
|
||||||
|
equal( result.substring(0,3), expected.substring(0,3), 'C,E are the first two - In that order');
|
||||||
});
|
});
|
||||||
|
|
||||||
// errors
|
// errors
|
||||||
|
Reference in New Issue
Block a user