Skip to content
This repository has been archived by the owner on Mar 26, 2018. It is now read-only.

Commit

Permalink
test(basename): add test for basename
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanebachelier committed Oct 27, 2014
1 parent ba261f5 commit 60c53f2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
26 changes: 25 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -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');
});
};
1 change: 0 additions & 1 deletion test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,3 @@ it('should revision .js file ok without any .map', function () {
var revisioned = fs.statSync(hashes[file]).size;
assert(revisioned === original);
});

0 comments on commit 60c53f2

Please sign in to comment.