Files
elasticsearch-js/test/utils/expect_sub_object.js
Spencer 7c1573fb07 Use standard and prettier (#10)
* switch from custom eslint config to standard + prettier

* fix new standard eslint violations

* add editorconfig file

* auto-fix all other violations

* update lint yarn script

* remove jshint comment
2019-07-09 13:24:13 -07:00

16 lines
415 B
JavaScript

var _ = require('lodash');
var expect = require('expect.js');
module.exports = function expectSubObject(obj, subObj) {
_.forOwn(subObj, function(val, prop) {
if (typeof obj[prop] === 'object') {
// non-strict equals
expect(obj[prop]).to.eql(
val,
'Expected property' + prop + ' of object to equal ' + val
);
} else {
expect(obj).property(prop, val);
}
});
};