Increase unit test coverage to ~95%

This commit is contained in:
Lovell Fuller
2014-10-21 12:22:23 +01:00
parent a531b5917e
commit 6cade5bd7f
10 changed files with 288 additions and 34 deletions

34
test/unit/sharpen.js Executable file
View File

@@ -0,0 +1,34 @@
'use strict';
var assert = require('assert');
var sharp = require('../../index');
var fixtures = require('../fixtures');
describe('Sharpen', function() {
it('sharpen image is larger than non-sharpen', function(done) {
sharp(fixtures.inputJpg)
.resize(320, 240)
.sharpen(false)
.toBuffer(function(err, notSharpened, info) {
if (err) throw err;
assert.strictEqual(true, notSharpened.length > 0);
assert.strictEqual('jpeg', info.format);
assert.strictEqual(320, info.width);
assert.strictEqual(240, info.height);
sharp(notSharpened)
.sharpen()
.toBuffer(function(err, sharpened, info) {
if (err) throw err;
assert.strictEqual(true, sharpened.length > 0);
assert.strictEqual(true, sharpened.length > notSharpened.length);
assert.strictEqual('jpeg', info.format);
assert.strictEqual(320, info.width);
assert.strictEqual(240, info.height);
done();
});
});
});
});