fix: webContents.print parameter validation error (#38614)

This commit is contained in:
Shelley Vohr 2023-06-09 21:41:01 +02:00 committed by GitHub
parent e8fd5fd3a8
commit c0d9764de9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 7 deletions

View file

@ -194,6 +194,14 @@ describe('webContents module', () => {
}).to.throw('webContents.print(): Invalid print settings specified.');
});
it('throws when an invalid pageSize is passed', () => {
const badSize = 5;
expect(() => {
// @ts-ignore this line is intentionally incorrect
w.webContents.print({ pageSize: badSize });
}).to.throw(`Unsupported pageSize: ${badSize}`);
});
it('throws when an invalid callback is passed', () => {
expect(() => {
// @ts-ignore this line is intentionally incorrect