Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Run a chai assertion for all elements in the array #2

Closed
sebpiq opened this Issue · 3 comments

2 participants

@sebpiq

for example

expect([1, 2, 3]).elements.to.be('number')
@RubenVerborgh

Good idea. I've been thinking of this too, but never found an appropriate syntax that fits with the existing:

[4, 11, 15].should.include.one.below(10)
[4, 11, 15].should.contain.some.above(10)
[4, 11, 15].should.not.contain.any.above(20)
[{ a: 'cat' }, { a: 'dog' }].should.contain.a.thing.with.property('a', 'cat')
[{ a: 'cat' }, { a: 'dog' }].should.contain.an.item.with.property('a', 'dog')

Any suggestions? I think elements is rather vague.

Some of mine would be:

[4, 11, 15].should.all.be.below(20)
[{ a: 'cat' }, { a: 'dog' }].should.all.have.property('a')
@sebpiq

Well ... to me all fits perfectly your current syntax!

@RubenVerborgh

Here you go :hatching_chick: Tell me how you like it!
Also, I'm always interested to see projects you're using Chai-Things in.

@RubenVerborgh RubenVerborgh was assigned
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.