title: How to assert JavaScript Object in Cypress?
body: <p>I am trying to get a text of a span tag and change it to number, then use assertion on this number
  This is my <code>command.js</code> file:</p>
  <pre class="lang-js prettyprint-override"><code>function num(){
    // this is the span text &quot;Published August 27th, 2020&quot;
    cy.get(&quot;span_text&quot;).then(function($el){
      var actualText = $el.text() 
      var split = actualText.split(&quot; &quot;)
      var year = split[split.length - 1];
      var x =  parseInt(year)
      return cy.wrap(x); // 2020
    })
  }
  
  Cypress.Commands.add('year', num)
  
  </code></pre>
  <p>And this is how I call it on my test file, and then using assertion:</p>
  <pre class="lang-js prettyprint-override"><code>// test.js
  const newProject = cy.year().then((value) =&gt; value
       console.log(value) // 2020 -&gt; OK
  );
  
  console.log(newProject) // [Object] here is my question, why is an Object in here ??? I expect to be be a same as 2020
  
  expect(newProject).to.be.greaterThan(2019) // expected [object Object] to be a number or a date
  
  </code></pre>
  <p>But I get this error message on Cypress log:</p>
  <pre><code>expected [object Object] to be a number or a date
  
  </code></pre>
  <p>I found out that I can't assert object instead of number. But I don't know how to assert return value of this object with another number. Can anyone help me and let me know what is wrong with my test, and how can I solve this?</p>