mardi 22 mai 2018

How to compare existing fields from object1 in object2 in javascript tests?

I should compare existing all fields and values from object1 in object2

example:

object1: {
  user: {
    id: 25,
    name: "Elon"
  }
};

object2: {
  user: {
    id: 25,
    name: "Elon",
    role: "admin"
  },
  rules: [
    "edit"
  ]
}

compareFn(object1, object2); //true

I can write this function, but I think that it exist in some testing framework, but I have not found :(

Can you help me? Thx!

Aucun commentaire:

Enregistrer un commentaire