-
Notifications
You must be signed in to change notification settings - Fork 1
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
SDK updates #56
SDK updates #56
Conversation
require.Nil(t, err) | ||
|
||
createUserBody := passage.CreateUserBody{ | ||
Email: RandomEmail, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would also be good to see a test case that captures a phone number as the identifier
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
created extra test
require.Nil(t, err) | ||
assert.Equal(t, RandomEmail, user.Email) | ||
|
||
userByIdentifier, err := psg.GetUserByIdentifier(RandomEmail) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RandomEmail
only generates lowercase letters.
Lines 29 to 30 in e4363a9
email := fmt.Sprintf("%X@email.com", randomChars) | |
return strings.ToLower(email) |
Another test case that searches for the mixed or uppercase counterpart would be good to make sure that there is no regression when you transform to lowercase inside the GetUserByIdentifier
method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
created specific all uppercase test
user.go
Outdated
var errorText string | ||
message := "failed to get Passage User By Identifier" | ||
limit := 1 | ||
ilikeIdentifier := "like:(?i)" + identifier |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sorry for the confusion -- I meant to say that your implementation of ToLower
works since we lowercase on the backend. Although this works too, if you prefer to keep the lowercase version because it is an exact matcher vs a regex matcher I would be good with that as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah gotcha. I am going to change it back to exact matcher since it is usually more performance than regex matcher. Thanks for the pro tip though! I did not know about the (?i)
.
user_test.go
Outdated
}) | ||
require.Nil(t, err) | ||
|
||
email := strings.ToUpper(RandomEmail) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: creating the user with an uppercase email and then searching for it with the same value wouldn't necessarily prove that the search is case insensitive. If the ToUpper
happened after CreateUser
and before or at GetUserByIdentifier
instead, it would be more accurate since this client doesn't know that the email is lowercased in the server.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! They are not suppose to be the same value! Updating this
This reverts commit 95995ee.
Quality Gate passedIssues Measures |
No description provided.