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:
WIP: us-east-1 is not supported, resolves #244
# One-line summary

> Issue : #244

## Description

Replacing us-east-1 that was EOLed with us-east-4 which is active. Should only be merged after https://github.com/saucelabs/node-saucelabs/pull/246

## Types of Changes
_What types of changes does your code introduce? Keep the ones that apply:_

- Bug fix (non-breaking change which fixes an issue)
- Configuration change

## Review
_List of tasks the reviewer must do to review the PR_
- [ ] Tests
- [ ] Documentation
- [ ] CHANGELOG

## Deployment Notes
These should highlight any db migrations, feature toggles, etc.


Patch:
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 449f15c..9a94366 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 (headless)
+     * - us-east-4
      */
     region?: ${regions};
     /**
diff --git a/src/constants.js b/src/constants.js
index c74e523..de7a8c4 100644
--- a/src/constants.js
+++ b/src/constants.js
@@ -97,7 +97,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 711fc15..c69babd 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -37,7 +37,6 @@ export function getRegionSubDomain(options = {}) {
 
   if (options.region === 'us') region = 'us-west-1';
   if (options.region === 'eu') region = 'eu-central-1';
-  if (options.headless) region = 'us-east-1';
   return region;
 }
 
@@ -46,7 +45,7 @@ export function getRegionSubDomain(options = {}) {
  * @param  {string}  servers   OpenAPI spec servers property
  * @param  {string}  basePath  OpenAPI spec base path
  * @param  {object}  options   client options
- * @return {string}            endpoint base url (e.g. `https://us-east1.headless.saucelabs.com`)
+ * @return {string}            endpoint base url (e.g. `https://api.us-east-4.saucelabs.com`)
  */
 export function getAPIHost(servers, basePath, options) {
   /**
@@ -86,14 +85,10 @@ 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) {
-  if (options.headless) {
-    options.region = 'us-east-1';
-  }
-
   if (options.region === 'staging') {
     options.tld = options.tld || 'net';
   }


Test patch:
diff --git a/tests/index.test.js b/tests/index.test.js
index afc0ff0..98cea9b 100644
--- a/tests/index.test.js
+++ b/tests/index.test.js
@@ -79,16 +79,6 @@ test('should expose a webdriverEndpoint', () => {
     'https://ondemand.eu-central-1.saucelabs.com/'
   );
 
-  const api3 = new SauceLabs({
-    user: 'foo',
-    key: 'bar',
-    region: 'eu',
-    headless: true,
-  });
-  expect(api3.webdriverEndpoint).toBe(
-    'https://ondemand.us-east-1.saucelabs.com/'
-  );
-
   const api4 = new SauceLabs({user: 'foo', key: 'bar', region: 'us-central-3'});
   expect(api4.webdriverEndpoint).toBe(
     'https://ondemand.us-central-3.saucelabs.com/'
diff --git a/tests/utils.test.js b/tests/utils.test.js
index 4296d8f..6534417 100644
--- a/tests/utils.test.js
+++ b/tests/utils.test.js
@@ -40,14 +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');
-  expect(
-    getAPIHost(sauceAPI.servers, sauceAPI.basePath, {
-      region: 'us-west-1',
-      headless: true,
-    })
-  ).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');
@@ -91,11 +85,8 @@ test('getAssetHost', () => {
   expect(getAssetHost({region: 'eu-central-1'})).toBe(
     'https://assets.eu-central-1.saucelabs.com'
   );
-  expect(getAssetHost({headless: true})).toBe(
-    'https://assets.us-east-1.saucelabs.com'
-  );
-  expect(getAssetHost({headless: true, region: 'eu'})).toBe(
-    'https://assets.us-east-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'