Closed stevenvachon closed 7 years ago
From Wiki https://en.wikipedia.org/wiki/Subset
The relationship of one set being a subset of another is called inclusion or sometimes containment.
so "containment" is an official naming of relation between sets
Ok, how about:
expect({...}).to.contain({...});
expect({...}).to.not.contain({...});
camelcase (containsSubset
) simply doesn't look sentence-like.
@stevenvachon it's already used by other assertion http://chaijs.com/api/bdd/#method_include include(value)
@param { Object | String | Number } obj @param { String } message optional The include and contain assertions can be used as either property based language chains or as methods to assert the inclusion of an object in an array or a substring in a string. When used as language chains, they toggle the contains flag for the keys assertion.
expect([1,2,3]).to.include(2);
expect('foobar').to.contain('foo');
expect({ foo: 'bar', hello: 'universe' }).to.include.keys('foo');
Since functions are objects in javascript, can we extend chai's builtin contain
to have a property of subset
with a value of a function?
looks much nicer than
containSubset()
.