Adding Unit test for File size!!! (#107)
* Added unit test for File Size * Added convert-units to the npm modules in travis.yml
This commit is contained in:
parent
4cb311b319
commit
234d4088f6
|
@ -2,4 +2,5 @@ language: node_js
|
|||
install:
|
||||
- npm install -g mocha
|
||||
- npm install chai jsonschema
|
||||
- npm install convert-units
|
||||
script: "mocha"
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
"homepage": "https://github.com/jmhobbs/cultofthepartyparrot.com#readme",
|
||||
"devDependencies": {
|
||||
"chai": "^3.5.0",
|
||||
"convert-units": "^2.1.0",
|
||||
"gulp": "^3.9.1",
|
||||
"gulp-data": "^1.2.1",
|
||||
"gulp-imagemin": "^3.1.1",
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
var fs = require('fs'),
|
||||
assert = require('chai').assert,
|
||||
convert = require('convert-units');
|
||||
|
||||
|
||||
describe("parrots", function() {
|
||||
|
||||
it("in HD should weight less than 64KB", function() {
|
||||
|
||||
var parrot_hd_gifs = fs.readdirSync(__dirname + '/../parrots/hd');
|
||||
parrot_hd_gifs.forEach(function(gif) {
|
||||
|
||||
var size = fs.statSync(__dirname + '/../parrots/hd/' + gif).size;
|
||||
assert(size <= convert(64).from('KB').to('B'), gif + " is too big(" + convert(size).from('B').to('KB') + " KB)");
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
it("in SD should weight less than 64KB", function() {
|
||||
|
||||
var parrot_hd_gifs = fs.readdirSync(__dirname + '/../parrots');
|
||||
parrot_hd_gifs.forEach(function(gif) {
|
||||
|
||||
var size = fs.statSync(__dirname + '/../parrots/' + gif).size;
|
||||
assert(size <= convert(64).from('KB').to('B'), gif + " is too big(" + convert(size).from('B').to('KB') + " KB)");
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue