Skip to content

Commit

Permalink
get raw file size
Browse files Browse the repository at this point in the history
  • Loading branch information
1000ch committed Feb 7, 2015
1 parent bc7b471 commit 85f0ed4
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion test/arguments-test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
var fs = require('fs');
var path = require('path');
var assert = require('assert');
var StyleStats = require('../lib/stylestats.js');

Expand Down Expand Up @@ -110,11 +112,19 @@ describe('Constructor Test', function () {
describe('File path', function() {
it('should return file size', function(done) {
var dirStats = new StyleStats('test/fixture/');
var size = fs.readdirSync('test/fixture/').filter(function (file) {
return path.extname(file) === '.css'
}).map(function (file) {
return fs.readFileSync('test/fixture/' + file).length;
}).reduce(function (previous, current, index, array) {
return previous + current;
});

dirStats.parse(function(error, dirResult) {
if (error) {
throw error;
}
assert.equal(dirResult.size, 20462);
assert.equal(dirResult.size, size);
done();
});
});
Expand Down

0 comments on commit 85f0ed4

Please sign in to comment.