title: how do I return value to error case in jasmine-mocking a promise?
body: <p>I am mocking a method that returns value to a promise. I am successful in returning value to positive case but can't seem to return value to negative case. I return value to success case by</p>
  
  <pre><code>return {
    then: function (callback) {
      return callback({'foo' : "bar"});
              }
          };
  </code></pre>
  
  <p>the method I am mocking (below)</p>
  
  <pre><code>login() {
    return axios.post("/login");
  }
  </code></pre>
  
  <p>returns control to </p>
  
  <pre><code>login().then((response) =&gt; {
      console.log("correct",response);
    }, (err)=&gt; {
      console.log("wrong response",err);
    });
  </code></pre>