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

feat(infrastructure): setup mock db env #6

Merged
merged 3 commits into from
Aug 28, 2023
Merged

feat(infrastructure): setup mock db env #6

merged 3 commits into from
Aug 28, 2023

Conversation

Yatanvesh
Copy link
Contributor

No description provided.

@github-actions
Copy link

github-actions bot commented Aug 28, 2023

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 100% 3 / 3
🔵 Statements 100% 3 / 3
🔵 Functions 100% 1 / 1
🔵 Branches 100% 1 / 1
File CoverageNo changed files found.
Generated in workflow #16

func HandleDashboardUserPostLogin(w http.ResponseWriter, r *http.Request) {
firebaseId := r.Context().Value(constants.FireBaseIdContextKey).(string)

if userExists, queryErr := db.GetQueries().CheckUserExists(r.Context(), firebaseId); queryErr != nil {
log.Error().Err(queryErr).Msg("failed to retrieve user")
dbQueries := db.GetQueries()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

i get the other 2 funcs, what about mocking dbQueries for this guy

Copy link
Member

Choose a reason for hiding this comment

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

i was wrong, db.Queries is actually a struct - not an interface. We cannot mock it.

What we can do is add an abstraction layer, and then mock it. But I think this is an overkill for now.

go-shared/db/connection.go Outdated Show resolved Hide resolved
@Goldziher Goldziher merged commit 2ef49dd into main Aug 28, 2023
4 checks passed
@Goldziher Goldziher deleted the BM-0001-tests branch August 28, 2023 18:43
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