Add failing spec for unknown user defaults
This commit is contained in:
parent
2e35b1c855
commit
cbffd598f9
1 changed files with 16 additions and 4 deletions
|
@ -37,14 +37,26 @@ describe('systemPreferences module', function () {
|
|||
}
|
||||
|
||||
it('returns values for known user defaults', function () {
|
||||
let locale = systemPreferences.getUserDefault('AppleLocale', 'string')
|
||||
assert.notEqual(locale, null)
|
||||
const locale = systemPreferences.getUserDefault('AppleLocale', 'string')
|
||||
assert.equal(typeof locale, 'string')
|
||||
assert(locale.length > 0)
|
||||
|
||||
let languages = systemPreferences.getUserDefault('AppleLanguages', 'array')
|
||||
assert.notEqual(languages, null)
|
||||
const languages = systemPreferences.getUserDefault('AppleLanguages', 'array')
|
||||
assert(Array.isArray(languages))
|
||||
assert(languages.length > 0)
|
||||
})
|
||||
|
||||
it('returns values for unknown user defaults', function () {
|
||||
assert.equal(systemPreferences.getUserDefault('UserDefaultDoesNotExist', 'boolean'), false)
|
||||
assert.equal(systemPreferences.getUserDefault('UserDefaultDoesNotExist', 'integer'), 0)
|
||||
assert.equal(systemPreferences.getUserDefault('UserDefaultDoesNotExist', 'float'), 0)
|
||||
assert.equal(systemPreferences.getUserDefault('UserDefaultDoesNotExist', 'double'), 0)
|
||||
assert.equal(systemPreferences.getUserDefault('UserDefaultDoesNotExist', 'string'), '')
|
||||
assert.equal(systemPreferences.getUserDefault('UserDefaultDoesNotExist', 'url'), '')
|
||||
assert.equal(systemPreferences.getUserDefault('UserDefaultDoesNotExist', 'badtype'), undefined)
|
||||
assert.deepEqual(systemPreferences.getUserDefault('UserDefaultDoesNotExist', 'array'), [])
|
||||
assert.deepEqual(systemPreferences.getUserDefault('UserDefaultDoesNotExist', 'dictionary'), {})
|
||||
})
|
||||
})
|
||||
|
||||
describe('systemPreferences.isInvertedColorScheme()', function () {
|
||||
|
|
Loading…
Reference in a new issue