feat: Add app.getLocaleCountryCode() method for region detection (#15035)

* Add method to get system´s user region

* Fix linter

* Remove auto types

* Improved detection for POSIX

* Change name, add specs, minor fixes

* Remove left overs

* Fix locale test

* Fix Linux test

* Coding style fixes

* Fix docs

* Add test excaption for Linux

* fix spelling

* Polishing
This commit is contained in:
Ondřej Záruba 2018-11-20 21:33:23 +01:00 committed by Shelley Vohr
parent 57d2ae1aec
commit de05ff894b
4 changed files with 58 additions and 0 deletions

View file

@ -122,6 +122,17 @@ describe('app module', () => {
})
})
describe('app.getLocaleCountryCode()', () => {
it('should be empty or have length of two', () => {
let expectedLength = 2
if (isCI && process.platform === 'linux') {
// Linux CI machines have no locale.
expectedLength = 0
}
expect(app.getLocaleCountryCode()).to.be.a('string').and.have.lengthOf(expectedLength)
})
})
describe('app.isPackaged', () => {
it('should be false durings tests', () => {
expect(app.isPackaged).to.be.false()