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

Add tests for Message #90

Merged
merged 4 commits into from
Jun 23, 2017
Merged

Add tests for Message #90

merged 4 commits into from
Jun 23, 2017

Conversation

donny-dont
Copy link

This adds tests for the Message class and begins the migration from unittest to test.

@donny-dont
Copy link
Author

@nex3 the tests were straight up copied from shelf with modifications to account for any differences between http and shelf. Also added expectations for the value of Message.isEmpty which weren't present in shelf. If any aren't applicable I'll remove.

Only other question was around contentLength. So in shelf it'll automatically get set to 0 if body is null. So wondering if we need to do anything to Message.isEmpty.

Copy link
Member

@nex3 nex3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only other question was around contentLength. So in shelf it'll automatically get set to 0 if body is null. So wondering if we need to do anything to Message.isEmpty.

I'm not sure if I follow. If the body is null, Message.isEmpty should be true, right?

pubspec.yaml Outdated
test: '^0.12.18'
# Override dependency on package_resolver to enable test
dependency_overrides:
package_resolver: '^1.0.0'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's with all the formatting changes?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can just move it all back to using "

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted

@donny-dont
Copy link
Author

  /// If `true`, the stream returned by [read] won't emit any bytes.
  ///
  /// This may have false negatives, but it won't have false positives.
  bool get isEmpty => _body.contentLength == 0;

There isn't currently a check for null its just checking for length being 0.

Copy link
Member

@nex3 nex3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There isn't currently a check for null its just checking for length being 0.

It looks like Body.contentLength is 0 when the user passes in a null body, so that should be fine.

test: "^0.12.18"
# Override dependency on package_resolver to enable test
dependency_overrides:
package_resolver: '^1.0.0'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be nice to add some newlines to make the pubspec a bit more readable.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At this point I was figuring we just fix it up when releasing 0.12.0 into the wild

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure.

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

Successfully merging this pull request may close these issues.

3 participants