title: Jasmine AJAX spy failure
body: <p>Ok these tests were passing a few bit ago. I have made no changes to which version of jasmine I'm using but... can anyone see obvious syntax errors here?</p>
  <pre><code>describe(&quot;ajax return&quot;, function() {
    beforeEach(function() {
      ajaxSpy = spyOn($, &quot;ajax&quot;)
    })
    describe(&quot;on success&quot;, function() {
      beforeEach(async function() {
        ajaxSpy.and.callFake(function(e) {
          e.success({&quot;success&quot;:true, &quot;remove&quot;:{1:&quot;test&quot;},&quot;assign_prestock&quot;:&quot;test2&quot;})
        })
        await catalogDOM.syncAvailability(null)
      })
      it(&quot;should call&quot;, function() {
        ...
      })
    })
  })
  </code></pre>
  <p>When running, I'm getting this error:</p>
  <pre><code>1_catalogDOM_spec.js:518 Uncaught (in promise) TypeError: e.success is not a function
  
  </code></pre>
  <p>UPDATE code for <code>catalogDOM.syncAvailability</code></p>
  <pre><code>catalogDOM.syncAvailability: function(item_name_id) {
    return new Promise(function(resolve, reject) {
      $.ajax({
        type:&quot;POST&quot;,
        url: &quot;/retrieve-options-availability&quot;,
        dataType:&quot;json&quot;,
        contentType:&quot;application/json&quot;,
        data: JSON.stringify(params)
      })
      .done(function(response, status_string, jqxhr) {
         if (response[&quot;success&quot;] == true) {
           resolve()
         } else {
           reject(response[&quot;message&quot;])
         }
      })
      .fail(function(jqxhr, error_string, exception_object){
        reject(&quot;Error loading availability. Refresh &amp; try again or contact us if this persists.&quot;)
      })
    }
  </code></pre>