function spyIsCalled(spy) {
    return new Promise((resolve) => {
      spy.and.callFake(resolve);
    });
  }
Wrap a spy in a promise so that it will resolve when the spy is called.

@param {!jasmine.Spy} spy
@return {!Promise}