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

test(hashmap): extract the hashmap fixtures #65

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,9 @@ module.exports = function (grunt) {
]);

grunt.registerTask('checkSummary', 'Check that summary attribute is correctly created', function () {
var hashes = grunt.file.readJSON('test/hashes.json');
var src = path.normalize('test/fixtures/file.png');
var expected = path.normalize('test/tmp/file.26365248.png');
var expected = path.normalize(hashes['test/fixtures/file.png']);
assert.equal(grunt.filerev.summary[src], expected);
});
};
7 changes: 7 additions & 0 deletions test/hashes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"test/fixtures/file.png": "test/tmp/file.26365248.png",
"test/fixtures/cfgfile.png": "test/tmp/cfgfile.da63.png",
"test/fixtures/math.js": "test/tmp/withSourceMaps/math.2f56179e.js",
"test/fixtures/math.js.map": "test/tmp/withSourceMaps/math.2f56179e.js.map",
"test/fixtures/physics.js": "test/tmp/withSourceMaps/physics.14a0a482.js"
}
9 changes: 1 addition & 8 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@
var fs = require('fs');
var assert = require('assert');

var hashes = {
'test/fixtures/file.png' : 'test/tmp/file.26365248.png',
'test/fixtures/cfgfile.png' : 'test/tmp/cfgfile.da63.png',
'test/fixtures/math.js' : 'test/tmp/withSourceMaps/math.2f56179e.js',
'test/fixtures/math.js.map' : 'test/tmp/withSourceMaps/math.2f56179e.js.map',
'test/fixtures/physics.js' : 'test/tmp/withSourceMaps/physics.14a0a482.js'
};
var hashes = require('./hashes.json');

it('should revision files based on content', function () {
var file = 'test/fixtures/file.png';
Expand Down Expand Up @@ -51,4 +45,3 @@ it('should revision .js file ok without any .map', function () {
var revisioned = fs.statSync(hashes[file]).size;
assert(revisioned === original);
});