From 60c53f24ad2fbfad50fee993f52a8f42a26a5fe4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bachelier?= Date: Mon, 27 Oct 2014 02:01:38 +0100 Subject: [PATCH] test(basename): add test for basename --- Gruntfile.js | 26 +++++++++++++++++++++++++- test/test.js | 1 - 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 0986aa2..f2aaa4a 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -57,6 +57,13 @@ module.exports = function (grunt) { cwd: 'test/fixtures', src: ['*.js'], dest: 'test/tmp/withSourceMaps' + }, + withBasenameOption: { + options: { + basename: true + }, + src: ['test/tmp/another.png'], + dest: 'test/tmp/relative' } }, simplemocha: { @@ -79,15 +86,32 @@ module.exports = function (grunt) { 'jshint', 'clean', 'copy', - 'filerev', + 'filerev:compile', + 'filerev:withConfig', + 'filerev:withDest', + 'filerev:withExpand', + 'filerev:withSummaryAttributeName', + 'filerev:withSourceMaps', 'checkSummary', + 'clearSummary', + 'filerev:withBasenameOption', + 'checkBasenameSummary', 'simplemocha', 'clean' ]); + grunt.registerTask('clearSummary', 'clear filerev summary', function () { + grunt.filerev.summary = {}; + }); + grunt.registerTask('checkSummary', 'Check that summary attribute is correctly created', function () { var src = path.normalize('test/fixtures/file.png'); var expected = path.normalize('test/tmp/file.26365248.png'); assert.equal(grunt.filerev.summary[src], expected); }); + + grunt.registerTask('checkBasenameSummary', 'Check that summary attribute is correctly created', function () { + assert.equal(Object.keys(grunt.filerev.summary)[0], 'another.png'); + assert.equal(grunt.filerev.summary['another.png'], 'another.92279d3f.png'); + }); }; diff --git a/test/test.js b/test/test.js index 1692408..7f942fd 100644 --- a/test/test.js +++ b/test/test.js @@ -51,4 +51,3 @@ it('should revision .js file ok without any .map', function () { var revisioned = fs.statSync(hashes[file]).size; assert(revisioned === original); }); -