To me, it seems just as clear to define custom matchers:
expect(someArray).toContain(42)
expect(someArray).toAllBe(42)
...thought a better name than "toAllBe" seems possible.
-- Sent from my HP Pre 3
On Mar 12, 2013 12:02 PM, Andre Asselin <ass...@gmail.com> wrote:
I was wondering if there is any interest, or any work queued up to extend expect() to check all/one element of an array. Something like this:
expectAll(someArray).toBe(42)
where the expectation would be true if EVERY element of the array was 42. Similarly, something like
expectOne(someArray).toBe(42)
would be true if at least 1 element of the array was 42. In other words, these are the mathematical Universal ∀ and Existential ∃ quantification.
Frisbyjs has something like this for REST testing work, and it's quite useful there, but it occurs to me that this would be a generically useful.
I can work up some patches if there's interest.
Any thoughts on what the syntax should look like? I can imagine a few alternatives:
expectAll(someArray).toBe(42) expectOne(someArray).toBe(42) / expectExists(someArray).toBe(42)
expect(someArray).all.toBe(42) expect(someArray).one.toBe(42)
- Andre Asselin
--
You received this message because you are subscribed to the Google Groups "Jasmine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
jasmine-js+...@googlegroups.com.
To post to this group, send email to
jasmi...@googlegroups.com.
Visit this group at
http://groups.google.com/group/jasmine-js?hl=en.
For more options, visit
https://groups.google.com/groups/opt_out.