title: Mock document.cookie using Javascript
body: <p>I am using Jasmine for unit testing, and document.cookie in my code. Is it possible to mock document.cookie in my test file ?</p>
  
  <p>I found out that I could use this : </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var mock = {
      value_: '', 
  
      get cookie() {
          return this.value_;
      },
  
      set cookie(value) {
          this.value_ += value + ';';
      }
  };</code></pre>
  </div>
  </div>
  </p>
  
  <p>But I don't know how to tell Javascript that I want to use this instead of the document.cookie ? 
  Is it possible ?</p>