title: How to mock Cookie.get('language') in JEST
body: <p>I have a function which sets a language in cookie and gets it for some functionality. How do I set the value of language correctly for testing in JEST</p>
  
  <pre><code>function resolveLanguage () {
    // browser cookie is checked to see if there is a value for language
    const lang = Cookie.get('language')
  
    // If no lang, it is defaulted to en 
    return lang || 'en'
  }
  </code></pre>
  
  <p>Now I want to test it in JEST</p>
  
  <pre><code>it('can resolve the language using a cookie', () =&gt; {
        Cookie.__defineGetter__("language", function() {
          return 'fr'
        })
        // console.log(Cookie.language) //returns fr
        // console.log(Cookie.get('language')) //returns fr
        expect(module.resolveLanguage()).toBe('fr') ---FAILS because it returns en
      })
  </code></pre>