chore: improve nativeImage path converter error (#21243)

This commit is contained in:
Shelley Vohr 2019-11-22 19:16:43 -08:00 committed by GitHub
parent 34452ee69e
commit d20273f95b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 2 deletions

View file

@ -1,6 +1,7 @@
import { expect } from 'chai'
import { Menu, Tray, nativeImage } from 'electron'
import { ifdescribe, ifit } from './spec-helpers'
import * as path from 'path'
describe('tray module', () => {
let tray: Tray
@ -12,6 +13,15 @@ describe('tray module', () => {
tray = null as any
})
describe('new Tray', () => {
it('throws a descriptive error for a missing file', () => {
const badPath = path.resolve('I', 'Do', 'Not', 'Exist')
expect(() => {
tray = new Tray(badPath)
}).to.throw(/Image could not be created from .*/)
})
})
ifdescribe(process.platform === 'darwin')('tray get/set ignoreDoubleClickEvents', () => {
it('returns false by default', () => {
const ignored = tray.getIgnoreDoubleClickEvents()