Fail fast for unknown interpolator

This commit is contained in:
Lovell Fuller
2015-04-20 11:22:21 +01:00
parent 54f2243386
commit 46cc45c186
3 changed files with 21 additions and 12 deletions

View File

@@ -94,15 +94,13 @@ describe('Interpolation', function() {
});
it('unknown interpolator throws', function(done) {
sharp(fixtures.inputJpg)
.resize(320, 240)
.interpolateWith('nonexistant')
.toBuffer()
.catch(function (e) {
assert(
e.toString().match(/VipsInterpolate: class "nonexistant" not found/)
);
})
.finally(done);
var isValid = false;
try {
sharp().interpolateWith('nonexistant');
isValid = true;
} catch (e) {}
assert(!isValid);
done();
});
});

View File

@@ -34,7 +34,7 @@ describe('Normalization', function () {
sharp(fixtures.inputJpgWithLowContrast)
.gamma()
.greyscale()
.normalize()
.normalize(true)
.raw()
.toBuffer(function (err, data, info) {
if (err) throw err;