How can I check that two objects have the same set of property names?
You can serialize simple data to check for equality: data1 = {firstName: ‘John’, lastName: ‘Smith’}; data2 = {firstName: ‘Jane’, lastName: ‘Smith’}; JSON.stringify(data1) === JSON.stringify(data2) This will give you something like ‘{firstName:”John”,lastName:”Smith”}’ === ‘{firstName:”Jane”,lastName:”Smith”}’ As a function… function compare(a, b) { return JSON.stringify(a) === JSON.stringify(b); } compare(data1, data2); EDIT If you’re using chai like you say, … Read more