Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

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

Closed
sebpiq opened this Issue Apr 4, 2013 · 3 comments

Comments

Projects
None yet
2 participants

sebpiq commented Apr 4, 2013

for example

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

RubenVerborgh commented Apr 4, 2013

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 commented Apr 4, 2013

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

RubenVerborgh added a commit that referenced this issue Apr 5, 2013

Collaborator

RubenVerborgh commented Apr 5, 2013

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

@ghost ghost assigned RubenVerborgh Apr 5, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment