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

more refactor to allow for additional capabilities #79

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nadavwe
Copy link
Collaborator

@nadavwe nadavwe commented Nov 9, 2021

this is a continuation on #78.
once the previous one is merged, we can merge this as well.

@nadavwe nadavwe requested a review from noam-almog November 9, 2021 09:49
haveHeaderInternal(headers, _.missing.isEmpty,
res => s"Could not find header [${res.missing.map(_._1).mkString(", ")}] but found those: [${res.identical.map(_._1).mkString(", ")}].")
haveHeaderInternal(headers,
{ case res if res.missing.nonEmpty || res.contentDiff.nonEmpty => s"Could not find header [${res.missing.names}] but found those: [${res.identical.names}]." }
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@noam-almog I actually think this is confusing to only show the identical names.
there could be a typo and the header name mismatch for some reason. in a way i think it might be more beneficial to explicitly say what was the same, what was missing, what was extra.
it could even be wiser to make the same error message for all those 3 matchers, since it would always give the same message - no surprises.

Copy link
Collaborator

Choose a reason for hiding this comment

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

can you show an example of what is confusing ? do you want to remove the identical names section of the message ?

Copy link
Collaborator Author

@nadavwe nadavwe Nov 10, 2021

Choose a reason for hiding this comment

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

for example, I expect (ABC -> "hi") instead the response came back with (ACB -> "hi"). it will show:
Could not find header [ABC] but found those: [].
which does not really help me identify the issue, don't you think?
As I said, I think it would be best to always give the entire information:
Found matching headers [...]. Found Matching headers with content difference [...]. missing headers are [..]. extra headers are [...].
wording is up to you. also, if it's too verbose we can omit sections that are empty.

Copy link
Collaborator

Choose a reason for hiding this comment

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

first, the first message displays an empty list which is a bug and needs to be fix anyhow.
as for your comments, looks better, pay attention when you present those errors show them with the order someone will be expect to see them. if you throw just large amount of text to the dev it will be too much.
i would go with:

Found Matching headers with content difference [...]

missing headers are [..]

extra headers are [...]

Matching headers [...]. . .  

Base automatically changed from header-matching-refactor to master November 9, 2021 16:23
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

Successfully merging this pull request may close these issues.

2 participants