We found this solution:
cy.get('#element').then(($field) => {
let isAExist = haveAttr($field[0].attributes, 'A')
let isBExist = haveAttr($field[0].attributes, 'B')
if (isAExist == false && isBExist == false) {
expect(true).to.be.equal(false)
console.log("There is no attr")
}
console.log("Attr exist")
})