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

Fix example in README.md #495

Merged
merged 1 commit into from Sep 5, 2018
Merged

Fix example in README.md #495

merged 1 commit into from Sep 5, 2018

Conversation

Otto-AA
Copy link
Contributor

@Otto-AA Otto-AA commented Aug 2, 2018

From my point of view, there's a typo and it should be name.toLowerCase() instead of name.toUpperCase().

describe('POST /user', function() {
  it('user.name should be an case-insensitive match for "john"', function(done) {
    request(app)
      .post('/user')
      .send('name=john') // x-www-form-urlencoded upload
      .set('Accept', 'application/json')
      .expect(function(res) {
        res.body.id = 'some fixed id';
        res.body.name = res.body.name.toUpperCase();
      })
      .expect(200, {
        id: 'some fixed id',
        name: 'john'
      }, done);
  });
});

@rimiti rimiti self-assigned this Sep 5, 2018
@rimiti
Copy link
Contributor

rimiti commented Sep 5, 2018

Hello @Otto-AA,

You're right, I merge it.

Thanks for you contribution.

@rimiti rimiti merged commit 5ec0b46 into ladjs:master Sep 5, 2018
@Otto-AA Otto-AA deleted the patch-1 branch September 5, 2018 10:09
@mikelax
Copy link
Contributor

mikelax commented Sep 5, 2018

@Otto-AA @rimiti I think the expectation here with this example is showing that you can modify the response body as the expectations are executed. So I think the correct fix would actually be to leave this line as it was: res.body.name = res.body.name.toUpperCase();

and instead change the line in the second .expect to: name: 'JOHN'

That would make sense based on the description before this code snippet.

@Otto-AA Otto-AA restored the patch-1 branch September 5, 2018 12:34
@Otto-AA
Copy link
Contributor Author

Otto-AA commented Sep 5, 2018

@mikelax Yes, that definitely makes more sense. As it is more common to compare in lowerCase (regarding to my experience) I'd change send('name=john') to send('name=JOHN').

If I want to change this, should I use the Revert button for that? Or just create a new pull request?

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

Successfully merging this pull request may close these issues.

None yet

3 participants