chore: add error throwing utility (#19803)

* chore: add error throwing utility

* feedback from review

* DRY out repeated isolate calls
This commit is contained in:
Shelley Vohr 2019-08-19 09:10:18 -07:00 committed by GitHub
commit 43e6d7fe88
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 118 additions and 4 deletions

View file

@ -117,6 +117,13 @@ describe('systemPreferences module', () => {
})
ifdescribe(process.platform === 'darwin')('systemPreferences.getSystemColor(color)', () => {
it('throws on invalid system colors', () => {
const color = 'bad-color'
expect(() => {
systemPreferences.getSystemColor(color as any)
}).to.throw(`Unknown system color: ${color}`)
})
it('returns a valid system color', () => {
const colors = ['blue', 'brown', 'gray', 'green', 'orange', 'pink', 'purple', 'red', 'yellow']