Check If An Array Of Strings Includes Another Array

preview_player
Показать описание
How do you check if one array of strings is a subset of another array of strings? You can use Chai assertion "include" to check each value one by one:

})

In Cypress, you can also use the Lodash _.difference method (Lodash is bundled with Cypress) to compute the difference array. If there are no extra values, that difference should be empty

const difference = Cypress._.difference(list, countries)

Рекомендации по теме