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

View File

@@ -30,11 +30,24 @@ describe('Alpha transparency', function() {
.toFile(fixtures.path('output.flatten-hex-orange.jpg'), done);
});
it('Do not flatten', function(done) {
sharp(fixtures.inputPngWithTransparency)
.flatten(false)
.toBuffer(function(err, data) {
if (err) throw err;
sharp(data).metadata(function(err, metadata) {
if (err) throw err;
assert.strictEqual('png', metadata.format);
assert.strictEqual(4, metadata.channels);
done();
});
});
});
it('Ignored for JPEG', function(done) {
sharp(fixtures.inputJpg)
.background('#ff0000')
.flatten()
.resize(500, 400)
.toBuffer(function(err, data) {
if (err) throw err;
sharp(data).metadata(function(err, metadata) {