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

Commit 74387df

Browse files
test(basename): add test for basename
1 parent cc995cb commit 74387df

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

Gruntfile.js

+25-1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,13 @@ module.exports = function (grunt) {
5757
cwd: 'test/fixtures',
5858
src: ['*.js'],
5959
dest: 'test/tmp/withSourceMaps'
60+
},
61+
withBasenameOption: {
62+
options: {
63+
basename: true
64+
},
65+
src: ['test/tmp/another.png'],
66+
dest: 'test/tmp/relative'
6067
}
6168
},
6269
simplemocha: {
@@ -79,15 +86,32 @@ module.exports = function (grunt) {
7986
'jshint',
8087
'clean',
8188
'copy',
82-
'filerev',
89+
'filerev:compile',
90+
'filerev:withConfig',
91+
'filerev:withDest',
92+
'filerev:withExpand',
93+
'filerev:withSummaryAttributeName',
94+
'filerev:withSourceMaps',
8395
'checkSummary',
96+
'clearSummary',
97+
'filerev:withBasenameOption',
98+
'checkBasenameSummary',
8499
'simplemocha',
85100
'clean'
86101
]);
87102

103+
grunt.registerTask('clearSummary', 'clear filerev summary', function () {
104+
grunt.filerev.summary = {};
105+
});
106+
88107
grunt.registerTask('checkSummary', 'Check that summary attribute is correctly created', function () {
89108
var src = path.normalize('test/fixtures/file.png');
90109
var expected = path.normalize('test/tmp/file.26365248.png');
91110
assert.equal(grunt.filerev.summary[src], expected);
92111
});
112+
113+
grunt.registerTask('checkBasenameSummary', 'Check that summary attribute is correctly created', function () {
114+
assert.equal(Object.keys(grunt.filerev.summary)[0], 'another.png');
115+
assert.equal(grunt.filerev.summary['another.png'], 'another.92279d3f.png');
116+
});
93117
};

test/test.js

-1
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,3 @@ it('should revision .js file ok without any .map', function () {
5151
var revisioned = fs.statSync(hashes[file]).size;
5252
assert(revisioned === original);
5353
});
54-

0 commit comments

Comments
 (0)