title: how to unit test promise that modifies a variable that gets sent to a 3rd party in typescript
body: <p>I am writing my first set of unit tests for typescript code and having hard time figuring our how to test <code>processRecord</code> method since it doesn't return the array that contains key logic output.</p>
  <pre><code> export const processRecord = async (event, context: AppContext) =&gt; {
    if (!event.Records) {
      return false;
    }
  
    const promises = event.Records.map(async (record: DynamoDBRecord) =&gt; {
      try {
        if (!record.dynamodb) {
          return false;
        }
  
        let newInsuranceNamesList: string[] = [];
        
        ...
        // some logic to update newInsuranceNamesList
        ...
  
        await sendTo3rdParty(newInsuranceNamesList);
      } catch (err) {
        console.error(err);
      }
    });
  
    return Promise.all(promises);
  };
  </code></pre>
  <p>Checking when <code>event.Records</code> or <code>record.dynamodb</code> doesn't exist is easy because it returns <code>false</code>.
  But the only real way for me to test <code>processRecord</code> is by checking contents of <code>newInsuranceNamesList</code> array. How can I achieve it in unit test?</p>