title: 'Unhandled Promise rejection:', 'Cannot read properties of undefined (reading 'then')'
body: <p>I have this error:</p>
  <pre><code>'Unhandled Promise rejection:', 'Cannot read properties of undefined (reading 'then')', '; Zone:', 'ProxyZone', '; Task:', 'jasmine.onComplete', '; Value:', TypeError: Cannot read properties of undefined (reading 'then')
  TypeError: Cannot read properties of undefined (reading 'then')
  </code></pre>
  <p>This is my <code>.ts</code> file:</p>
  <pre><code>getPillars = async (): Promise&lt;void&gt; =&gt; {
  
          if (localStorage.getItem('pillars')) {
              this.pillars = JSON.parse(localStorage.getItem('pillars'));
              return;
          }
  
          let items = await this.api.send('Categories', 'get', filter ? { filter: filter } : {}).then((res: { data: any[], count: number }) =&gt; {
              return res.data.map(el =&gt; {
                  return { id: el.id, name: el.name, type: 'Categories' }
              });
          });
          localStorage.setItem('pillars', JSON.stringify(items));
  
          this.pillars = items;
      }
  </code></pre>
  <p>And my test file:</p>
  <pre><code>describe('getPillars()', () =&gt; {
      it('Should validate the session success', () =&gt; {
          let spy1 = spyOn(apiService, 'send').and.returnValue(Promise.resolve(of('pillars')));
  
          component.getPillars();
  
          expect(spy1).toHaveBeenCalled();
        });
    });
  </code></pre>