title: "Missing region in config" after attempting to mock SecretsManager with Jest
body: <p>I'm currently attempting to mock AWS SecretsManager for my unit testing with Jest, and everytime I'm hit with the <code>ConfigError</code>
  My code is somewhat like this</p>
  <pre><code>//index.ts
  import SM from &quot;aws-sdk/clients/secretsmanager&quot;
  const secretManagerClient = new SM()
  ...
  export const randomMethod = async (a: string, b: string) =&gt; {
    let secret
    const personalToken = {
      SecretId: process.env.secretId,
    }
    secretManagerClient
      .getSecretValue(personalToken, (err, data) =&gt; {
        if (err) {
          console.error(`[SECRETS MANAGER] Error fetching personal token : ${err}`)
        } else if (data &amp;&amp; data.SecretString) {
          secret = data.SecretString
        }
      })
  }
  </code></pre>
  <p>My mock goes like this :</p>
  <pre class="lang-js prettyprint-override"><code>//index.test.js
  const mockGetSecretValue = jest.fn((SecretId) =&gt; {
    switch (SecretId) {
      case process.env.GITHUB_PERSONAL_TOKEN:
        return {
          SecretString: process.env.GITHUB_PERSONAL_TOKEN_VALUE,
        }
      default:
        throw Error(&quot;secret not found&quot;)
    }
  })
  
  jest.mock(&quot;aws-sdk/clients/secretsmanager&quot;, () =&gt; {
    return jest.fn(() =&gt; {
      return {
        getSecretValue: jest.fn(({ SecretId }) =&gt; {
          return mockGetSecretValue(SecretId)
        }),
        promise: jest.fn(),
      }
    })
  })
  </code></pre>
  <p>However, I get this error thrown at me : <code>ConfigError: Missing region in config</code>, which I understand to some extent, however I don't understand why it occurs here in the mocking part...</p>
  <p>Thanks in advance!</p>
  <p>EDIT: Thanks to the 1st answer, I've managed to stop having this error. However, the <code>getSecretValue()</code> method is not returning the Secret value I want.</p>