Skip to content

154088163 Ft Users can get top rated resources #43

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

Open
wants to merge 1 commit into
base: staging
Choose a base branch
from

Conversation

mikey2020
Copy link
Collaborator

Why is this important?

  • To allow users get access to the most recommended resources on the platform.

Description of task to be completed?

  • Add handler to get top rated resources
  • Add tests for getting top rated resources
  • Add test data to utils_test file

- Add handler to get top rated resources
- Add tests for getting top rated resources
- Add test data to utils_test file
@mikey2020 mikey2020 requested a review from tomipaul June 28, 2019 20:11
@@ -154,7 +154,7 @@ type Resource struct {
Privacy string `sql:",notnull" json:",omitempty"`
Type string `sql:",notnull" json:",omitempty"`
Views int64 `json:",omitempty"`
Recommendations int64 `json:",omitempty"`
Recommendations int64 `sql:",notnull" json:",omitempty"`
Copy link
Owner

Choose a reason for hiding this comment

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

Can you test the create resource endpoint please. I'm thinking this might be a breaking change for it.

Copy link
Collaborator Author

@mikey2020 mikey2020 Dec 8, 2019

Choose a reason for hiding this comment

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

@tomipaul Are you saying write test for this or run the tests we already have for it ?

Copy link
Owner

Choose a reason for hiding this comment

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

@mikey2020 I don't remember what the implementation of the create resource endpoint looks like. But I'm thinking a not null directive could have broken something. So in the mean time you could just run all the tests we already have. I will take a look at the implementation tonight. You can take a look at it too so we can be sure nothing breaks.

)
return
}
fmt.Println(err)
Copy link
Owner

Choose a reason for hiding this comment

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

Is this print stmt necessary?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No I dont think so

t.Fatalf("Expected resource title %s to equal %s", actualResourceTitle1, expectedResourceTitle1)
}

})
Copy link
Owner

Choose a reason for hiding this comment

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

About the tests, you would remember I updated the supertest we were using to be able to use the request to make assertions like this in all scenarios

Request(testServer.URL, t).
				Get(fmt.Sprintf("%v%v", resourceURI, publicResource.Id)).
				Set("authorization", userToken).
				Expect(200).
				Expect("Content-Type", "application/json").
				Expect(expectedResponse).
				End()

We can still merge this and later we'll have a task to harmonize every tests to follow that pattern. The advantage I was trying to get was to make the whole test structure simple and consistent; simulate expected response and just do a whole big assert. I'm not sure but it seems I made it in such a way that it will work for partial responses too.
I will take a look.

@tomipaul
Copy link
Owner

@mikey2020 I have some comments

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