-
Notifications
You must be signed in to change notification settings - Fork 61
STITCH-3383 add client sdk FunctionCredential #329
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
Conversation
mburdette
left a comment
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.
Looks good, just some nits really
| CustomProviderConfig, | ||
| CustomProvider | ||
| CustomProvider, | ||
| FunctionProviderConfig, |
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.
[nit/questions] I think in other places we are calling this CustomFunction not sure if its worth making the change here as well?
| CustomProviderConfig, | ||
| CustomProviderConfig, | ||
| FunctionProvider, | ||
| FunctionProviderConfig, |
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.
and here
| CustomProviderConfig, | ||
| CustomProvider, | ||
| FunctionProvider, | ||
| FunctionProviderConfig, |
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.
and here
| expect(FunctionAuthProvider.TYPE).toEqual(user.identities[0].providerType); | ||
| expect(client.auth.isLoggedIn).toBeTruthy(); | ||
| }); | ||
|
|
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.
can we also add some fail tests as well as tests that actually use whats in the payload?
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.
We check the contents of the payload– what do you mean "use what's in the payload"?
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.
in your function, use something from the payload, to verify that you are sending it correctly and is usable...your function right now just returns "foo" so for all I know the sdk isn't sending the function credential payload correctly...
| expect(client.auth.listUsers().length).toBe(2); | ||
| }); | ||
|
|
||
| it("should authenticate using a custom function", async () => { |
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.
can we also add some fail tests as well as tests that actually use whats in the payload?
|
|
||
| expect(user.id).toBeDefined(); | ||
| expect(user.identities[0].id).toBeDefined(); | ||
| expect("foo").toEqual(user.identities[0].id); |
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.
[nit] if you gonna use a string in two places use a const
|
|
||
| expect(user.id).toBeDefined(); | ||
| expect(user.identities[0].id).toBeDefined(); | ||
| expect("foo").toEqual(user.identities[0].id); |
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.
[nit] if you gonna use a string in two places use a const
|
|
||
| expect(user.id).toBeDefined(); | ||
| expect(user.identities[0].id).toBeDefined(); | ||
| expect("foo").toEqual(user.identities[0].id); |
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.
[nit] if you use a string in two places use a const
| expect(FunctionAuthProvider.TYPE).toEqual(user.identities[0].providerType); | ||
| expect(client.auth.isLoggedIn).toBeTruthy(); | ||
| }); | ||
|
|
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.
can we also add some fail tests as well as tests that actually use whats in the payload?
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'll add a fail test, but it will only be to assert that we catch the error properly. Other testing should be done serverside.
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.
the fail test should be testing that login fails when the functions returns something that isn't a string or it throws an error. "catch the error" has nothing to do with it. The point of the test is to make sure that something bad doesn't in your sdk code, when login fails. Obviously the backend is testing this as well.
|
@mburdette PTAL |
mburdette
left a comment
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.
LGTM thanks for getting this done
No description provided.