Cypress.io - How to use ElementsCollection

I should check if the page have 20 elements.

It’s very easy with Selenide

$$("[data-test='topic-item']").shouldHave(CollectionCondition.size(20));

But I haven’t idea how to do it with Cypress.io

cy.get('ul>li').each(function () {...}) // Iterate through each 'li'