Skip to content
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

fuzzy matching of response bodies #58

Closed
timoxley opened this issue Apr 16, 2013 · 5 comments
Closed

fuzzy matching of response bodies #58

timoxley opened this issue Apr 16, 2013 · 5 comments

Comments

@timoxley
Copy link

Idea would be be able to be able to match partial responses ala component/to-function:

request(app)
.get('/users')
// don't care about other properties
// nor the exact details of timestamp property
// just that it exists and is numeric
.expect({ "timestamp":/\n+/}) 
.expect(200, done)
@timoxley
Copy link
Author

Also, if it were possible to just pass a sole function to expect, I could match however I wanted:

e.g.

.expect(function(res) {
  return _({ "timestamp":/\n+/})(res.body)
}) 
.expect(200, done)

@timoxley
Copy link
Author

I guess I could just do this in the final callback, but it'd be nice to be able to modularise the assertions:

.expect(hasTimestamp)
.expect(hasSpecialHeaders)
.expect(200, done)

@ricardobeat
Copy link

+1 for this.

My expectation was that .expect would be fuzzy by default, both for modularizing assertions and ignoring fields which might not be predictable (e.g. a generated _id).

Related: #72

@JogoShugh
Copy link

This would be very cool. Was just wondering whether I could do this.

@gjohnson
Copy link
Contributor

Added in #87

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants