Add level constructor opt for multi-level input #2222

This commit is contained in:
Lovell Fuller
2020-06-06 16:10:56 +01:00
parent 98e0516ac1
commit 7f142bddb3
7 changed files with 65 additions and 29 deletions

View File

@@ -659,6 +659,19 @@ describe('Input/output', function () {
sharp({ pages: '1' });
}, /Expected integer between -1 and 100000 for pages but received 1 of type string/);
});
it('Valid level property', function () {
sharp({ level: 1 });
});
it('Invalid level property (string) throws', function () {
assert.throws(function () {
sharp({ level: '1' });
}, /Expected integer between 0 and 256 for level but received 1 of type string/);
});
it('Invalid level property (negative) throws', function () {
assert.throws(function () {
sharp({ level: -1 });
}, /Expected integer between 0 and 256 for level but received -1 of type number/);
});
});
describe('create new image', function () {