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 test cases for JSON resource marshaling #1916

Closed
wants to merge 61 commits into from

Conversation

sagar23sj
Copy link
Contributor

Resources Covered :

  • FeedLink
  • Feeds

Helps with issue: #55

fho and others added 9 commits June 18, 2021 14:57
The types of the fields of the EditChange struct were defined inline as
anonymous structs.
This made it tedious to use the EditChange struct in testcases, because
the anonymous type needed to be redefined (incl the exact same JSON
tags) whenever it was assigned. The TestEdit* testcases are good example
for it.

Using anonymous struct also does not scale well when the struct changes.
For example when a field is added to an anonymous struct, every place
where the anonymous struct is assigned must also be changed.

Another advantage of using regular types is that accessors  will be
generated automatically and can be used instead of having to manually
check for nil values when accessing the struct fields.

Define the types as regular structs in event_types.go instead.
Co-authored-by: Glenn Lewis <6598971+gmlewis@users.noreply.github.com>
@google-cla google-cla bot added the cla: yes Indication that the PR author has signed a Google Contributor License Agreement. label Jun 24, 2021
@codecov
Copy link

codecov bot commented Jun 24, 2021

Codecov Report

Merging #1916 (c50bff0) into master (eb2b7f4) will increase coverage by 0.18%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1916      +/-   ##
==========================================
+ Coverage   97.65%   97.84%   +0.18%     
==========================================
  Files         105      105              
  Lines        6786     6809      +23     
==========================================
+ Hits         6627     6662      +35     
+ Misses         86       80       -6     
+ Partials       73       67       -6     
Impacted Files Coverage Δ
github/activity.go 100.00% <ø> (ø)
github/code-scanning.go 100.00% <ø> (ø)
github/event_types.go 100.00% <ø> (ø)
github/issues_timeline.go 100.00% <ø> (ø)
github/pulls.go 97.05% <ø> (ø)
github/github.go 97.02% <100.00%> (+0.01%) ⬆️
github/messages.go 97.05% <100.00%> (+0.18%) ⬆️
github/repos.go 98.75% <100.00%> (+0.04%) ⬆️
github/repos_contents.go 89.68% <0.00%> (+3.17%) ⬆️
github/actions_artifacts.go 100.00% <0.00%> (+6.45%) ⬆️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update eb2b7f4...c50bff0. Read the comment docs.

Copy link
Collaborator

@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

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

Thank you, @sagar23sj !
LGTM.

Awaiting second LGTM before merging.

@gmlewis gmlewis requested a review from wesleimp June 24, 2021 20:11
@gmlewis gmlewis changed the title Adds test cases for JSON resource marshalling Add test cases for JSON resource marshaling Jul 8, 2021
Copy link

@Parker77 Parker77 left a comment

Choose a reason for hiding this comment

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

LGTM.

@sagar23sj
Copy link
Contributor Author

Hi @gmlewis. this will also break I guess due to changes in #1900. I will fix this PR as soon as #1900 is merged.

@google-cla
Copy link

google-cla bot commented Jul 9, 2021

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@google-cla google-cla bot added cla: no and removed cla: yes Indication that the PR author has signed a Google Contributor License Agreement. labels Jul 9, 2021
@sagar23sj
Copy link
Contributor Author

sagar23sj commented Jul 9, 2021

Hi @gmlewis, somehow i managed to ruin the PR while trying to rebase current branch with the latest merges on master.
Could you please help me fix this??

Steps i performed :

  1. rebase local master with upstream/master
  2. rebase working branch with local master
  3. git pull origin branch_name
    (since i was getting some error: Updates were rejected because the tip of your current branch is behind)
  4. git push origin branch_name

@gmlewis
Copy link
Collaborator

gmlewis commented Jul 9, 2021

Hmmm... this is now pretty challenging to fix and not worth the effort.

How about closing this PR and creating a new one with the two test additions for:

  • FeedLink
  • Feeds

?

@sagar23sj
Copy link
Contributor Author

I can do that @gmlewis . Earlier I was thinking of force push the changes, but I read your comments on other PRs where you mentioned that it doesn't allow you to see the changes, so I didn't force push the changes.

I will close this PR then and raise a new one, but can you tell me how do i resolve merge conflicts for other PRs??

@gmlewis
Copy link
Collaborator

gmlewis commented Jul 9, 2021

I'm away from my computer this weekend, but you can try a force push if you wish, or close and create new PRs if you wish... whichever is easier.

As for the other ones, creating new PRs might be just as easy as trying to merge. Your call.

@sagar23sj
Copy link
Contributor Author

Ok @gmlewis . For the ruined PRs i will raise new ones and for other PRs I'll see what I can do.

Thanks and have a great weekend

@sagar23sj sagar23sj closed this Jul 10, 2021
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.