Repository: saucelabs/node-saucelabs (js)

Issue:
remove us-east-1 datacenter
## Expected Behavior

All datacenter and their APIs exist. Currently, running `sl --headless` doesn't not work

## Actual Behavior

us-east-1 was EOLed some time ago


## Specifications

  - Version:
  - Platform:
  - Subsystem:


Pull request:
resolves #244
# One-line summary

> Issue : #244

`s/us-east-1/us-east-4/g`

## Description

Some time ago Sauce Labs EOLed the us-east-1 region and and added new one - us-east-4. `us-east-4` region hosts real mobile devices only so some of the APIs are not supported there.

## Types of Changes
_What types of changes does your code introduce? Keep the ones that apply:_

- Configuration change

## Review
_List of tasks the reviewer must do to review the PR_
- [x] Tests
- [x] Documentation
- [ ] CHANGELOG


Patch:
diff --git a/README.md b/README.md
index 9325185..5f65ed0 100644
--- a/README.md
+++ b/README.md
@@ -33,6 +33,7 @@ Your Sauce Labs datacenter region. The following regions are available:
 
 - `us-west-1` (short `us`)
 - `eu-central-1` (short `eu`)
+- `us-east-4` (real mobile devices only)
 
 Type: `string`
 Default: `us`
diff --git a/apis/builds.json b/apis/builds.json
index 1af3576..7b3eec5 100644
--- a/apis/builds.json
+++ b/apis/builds.json
@@ -13,7 +13,7 @@
         "region": {
           "default": "us-west-1",
           "description": "region of datacenter",
-          "enum": ["us-west-1", "us-east-1", "eu-central-1", "staging"]
+          "enum": ["us-west-1", "us-east-4", "eu-central-1", "staging"]
         },
         "tld": {
           "default": "com",
diff --git a/apis/sauce.json b/apis/sauce.json
index 8c9d149..063129c 100644
--- a/apis/sauce.json
+++ b/apis/sauce.json
@@ -24,7 +24,7 @@
         "region": {
           "default": "us-west-1",
           "description": "region of datacenter",
-          "enum": ["us-west-1", "us-east-1", "eu-central-1", "staging"]
+          "enum": ["us-west-1", "us-east-4", "eu-central-1", "staging"]
         },
         "tld": {
           "default": "com",
diff --git a/apis/teamManagement.json b/apis/teamManagement.json
index 27e5eab..0a1f97f 100644
--- a/apis/teamManagement.json
+++ b/apis/teamManagement.json
@@ -13,7 +13,7 @@
         "region": {
           "default": "us-west-1",
           "description": "region of datacenter",
-          "enum": ["us-west-1", "us-east-1", "eu-central-1", "staging"]
+          "enum": ["us-west-1", "us-east-4", "eu-central-1", "staging"]
         },
         "tld": {
           "default": "com",
diff --git a/scripts/constants.js b/scripts/constants.js
index c1758cf..135df21 100644
--- a/scripts/constants.js
+++ b/scripts/constants.js
@@ -25,7 +25,7 @@ export interface SauceLabsOptions {
      *
      * - us-west-1 (short 'us')
      * - eu-central-1 (short 'eu')
-     * - us-east-1
+     * - us-east-4
      */
     region?: ${regions};
     /**
diff --git a/src/constants.js b/src/constants.js
index 7e2582c..5b049b5 100644
--- a/src/constants.js
+++ b/src/constants.js
@@ -96,7 +96,7 @@ export const ASSET_REGION_MAPPING = {
   us: '',
   eu: 'eu-central-1.',
   'us-west-1': '',
-  'us-east-1': 'us-east-1.',
+  'us-east-4': 'us-east-4.',
   'eu-central-1': 'eu-central-1.',
   staging: 'staging.',
 };
diff --git a/src/utils.js b/src/utils.js
index 7e28cdf..342492f 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -85,7 +85,7 @@ export function getAPIHost(servers, basePath, options) {
  * helper to generate host for assets, like:
  * https://assets.saucelabs.com/jobs/<jobId>/selenium-server.log
  * https://assets.eu-central-1.saucelabs.com/jobs/<jobId>/log.json
- * https://assets.us-east-1.saucelabs.com/jobs/<jobId>/log.json
+ * https://assets.us-east-4.saucelabs.com/jobs/<jobId>/log.json
  * https://assets.staging.saucelabs.net/jobs/<jobId>/log.json
  */
 export function getAssetHost(options) {


Test patch:
diff --git a/tests/index.test.js b/tests/index.test.js
index 94a75c9..10724fa 100644
--- a/tests/index.test.js
+++ b/tests/index.test.js
@@ -81,10 +81,10 @@ test('should expose a webdriverEndpoint', () => {
   const api3 = new SauceLabs({
     user: 'foo',
     key: 'bar',
-    region: 'us-east-1',
+    region: 'us-east-4',
   });
   expect(api3.webdriverEndpoint).toBe(
-    'https://ondemand.us-east-1.saucelabs.com/'
+    'https://ondemand.us-east-4.saucelabs.com/'
   );
 
   const api4 = new SauceLabs({user: 'foo', key: 'bar', region: 'us-central-3'});
diff --git a/tests/utils.test.js b/tests/utils.test.js
index c9d0779..84af09f 100644
--- a/tests/utils.test.js
+++ b/tests/utils.test.js
@@ -40,8 +40,8 @@ test('getAPIHost', () => {
     getAPIHost(sauceAPI.servers, sauceAPI.basePath, {region: 'us-west-1'})
   ).toBe('https://api.us-west-1.saucelabs.com/rest');
   expect(
-    getAPIHost(sauceAPI.servers, sauceAPI.basePath, {region: 'us-east-1'})
-  ).toBe('https://api.us-east-1.saucelabs.com/rest');
+    getAPIHost(sauceAPI.servers, sauceAPI.basePath, {region: 'us-east-4'})
+  ).toBe('https://api.us-east-4.saucelabs.com/rest');
   expect(
     getAPIHost(sauceAPI.servers, sauceAPI.basePath, {host: 'http://foobar.com'})
   ).toBe('http://foobar.com/rest');
@@ -79,6 +79,9 @@ test('getAssetHost', () => {
   expect(getAssetHost({region: 'eu-central-1'})).toBe(
     'https://assets.eu-central-1.saucelabs.com'
   );
+  expect(getAssetHost({region: 'us-east-4'})).toBe(
+    'https://assets.us-east-4.saucelabs.com'
+  );
   expect(getAssetHost({region: 'staging'})).toBe(
     'https://assets.staging.saucelabs.net'
   );