Increase unit test coverage for recently added operations

Switch param validation to use internal functions
This commit is contained in:
Lovell Fuller
2016-07-11 22:23:10 +01:00
parent ff8c42e894
commit d1d6155fd1
6 changed files with 111 additions and 122 deletions

View File

@@ -24,7 +24,7 @@ describe('Trim borders', function() {
it('16-bit PNG with alpha channel', function(done) {
sharp(fixtures.inputPngWithTransparency16bit)
.resize(32, 32)
.trim()
.trim(20)
.toBuffer(function(err, data, info) {
if (err) throw err;
assert.strictEqual(true, data.length > 0);
@@ -36,4 +36,13 @@ describe('Trim borders', function() {
});
});
describe('Invalid thresholds', function() {
[-1, 100, 'fail', {}].forEach(function(threshold) {
it(threshold, function() {
assert.throws(function() {
sharp().trim(threshold);
});
});
});
});
});