Browse Source

fix: relax app.getLocaleCountryCode() test (#29679)

If the app is run with LC_ALL=C on Linux, the test would fail as
app.getLocaleCountryCode() would return "".

Signed-off-by: Darshan Sen <[email protected]>
Darshan Sen 3 years ago
parent
commit
cfc846a337
1 changed files with 3 additions and 6 deletions
  1. 3 6
      spec-main/api-app-spec.ts

+ 3 - 6
spec-main/api-app-spec.ts

@@ -122,12 +122,9 @@ describe('app module', () => {
 
   describe('app.getLocaleCountryCode()', () => {
     it('should be empty or have length of two', () => {
-      let expectedLength = 2;
-      if (process.platform === 'linux' && process.env.CI) {
-        // Linux CI machines have no locale.
-        expectedLength = 0;
-      }
-      expect(app.getLocaleCountryCode()).to.be.a('string').and.have.lengthOf(expectedLength);
+      const localeCountryCode = app.getLocaleCountryCode();
+      expect(localeCountryCode).to.be.a('string');
+      expect(localeCountryCode.length).to.be.oneOf([0, 2]);
     });
   });