assert response body multiple times #37

Merged
merged 1 commit into from Nov 27, 2012

2 participants

@fengmk2

I found out supertest only check body only once.

Some scenes, we need to check different texts check for body.

@fengmk2

Unit test all pass on my mbp.

$ make test


  request(app)
    ✔ should fire up the app on an ephemeral port 
    ✔ should work with an active server 
    ✔ should work with remote server 
    ✔ should work with a https server 
    ✔ should work with .send() etc 
    ✔ should work when unbuffered 
    ✔ should default redirects to 0 (69ms)
    .expect(status[, fn])
      ✔ should assert the response status 
    .expect(status, body[, fn])
      ✔ should assert the response body and status 
      when the body argument is an empty string
        ✔ should not quietly pass on failure 
    .expect(body[, fn])
      ✔ should assert the response body 
      ✔ should assert the response text 
      ✔ should assert the parsed response body 
      ✔ should support regular expressions 
      ✔ should assert response body multiple times 
    .expect(field, value[, fn])
      ✔ should assert the header field presence 
      ✔ should assert the header field value 
      ✔ should assert multiple fields 
      ✔ should support regular expressions 


  ✔ 19 tests complete (333 ms)
@fengmk2

@visionmedia Please review this when you are free.

@fengmk2

@visionmedia Can you review this?

@tj tj merged commit bd84172 into visionmedia:master Nov 27, 2012
@tj
Sloth member
tj commented Nov 27, 2012

we should also add a test that doesn't pass an exception, to show that it does in fact work with multiple valid assertions

@fengmk2

OK, I do that right now.

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