function waitableFunction(name = 'func') {
  const [promise, resolve] = flatPromise()
  const fn = jasmine.createSpy(name, resolve).and.callThrough()

  fn.toBeCalled = () => promise
  return fn
}
Create a spy-able function which resolves a Promise
once it is called.