title: How can I test if a $cookie was set in an AngularJS service?
body: <p>My service is:</p>
  
  <pre><code>myApp.service('userService', [
    '$http', '$q', '$rootScope', '$state', '$cookies', '$base64', function($http, $q, $rootScope, $state, $cookies, $base64) {
      var user;
      user = {};
  
      this.logout = function() {
        user = {};
        delete $cookies.userAccessKey;
        return $state.transitionTo('login');
      };
    }
  ]);
  </code></pre>
  
  <p>I want to write a unit test to make sure that the <code>$cookies.userAccessKey</code> was deleted. How can I do this? While I'm at it, how can I ensure that <code>user</code> was set to empty?</p>