-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wider expect.it use? #330
Comments
Good idea. If we consider |
jest's expect({apples: 6, bananas: 3}).toEqual({
apples: expect.toBeWithinRange(1, 10),
bananas: expect.not.toBeWithinRange(11, 20),
}); (example taken from https://jestjs.io/docs/en/expect#expectextendmatchers) It seems like a good idea to me. |
@papandreou just nothing that a full implementation of that is available in jest-unexpected in case we want to crib anything. That said, I guess I'd lean on the side of expect.it being our canonical solution for this. Did I miss a nuance in your suggestion though? |
Well, I don't think it'd be easy to implement this, especially not if we want it across every assertion. The "good idea" part was mostly a tip of the hat to the idea in general and the nice and intuitive composition it offers. Years ago we talked about blurring the lines between |
We already have this functionality with To have properties asserting against an object is just a left-over from before the |
Yes! |
As most things 'just work' in unexpected, I tried out
Not surprised, but a little sad it didn't work :)
(And yes, i know
expect(foo, 'to satisfy', {foo: expect.it('to be an', Array)})
, but I thought the other might be more readable...The text was updated successfully, but these errors were encountered: