Skip to content

Conversation

@jsflax
Copy link
Contributor

@jsflax jsflax commented Nov 3, 2019

No description provided.

@coveralls
Copy link

coveralls commented Nov 3, 2019

Coverage Status

Coverage decreased (-0.07%) to 79.101% when pulling 35a26d5 on jsflax:STITCH-3383 into e75a2ea on mongodb:master.

@jsflax jsflax requested a review from mburdette November 3, 2019 17:42
Copy link
Contributor

@mburdette mburdette left a 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,
Copy link
Contributor

@mburdette mburdette Nov 4, 2019

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,
Copy link
Contributor

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,
Copy link
Contributor

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();
});

Copy link
Contributor

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?

Copy link
Contributor Author

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"?

Copy link
Contributor

@mburdette mburdette Nov 5, 2019

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 () => {
Copy link
Contributor

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);
Copy link
Contributor

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);
Copy link
Contributor

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);
Copy link
Contributor

@mburdette mburdette Nov 4, 2019

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();
});

Copy link
Contributor

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?

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'll add a fail test, but it will only be to assert that we catch the error properly. Other testing should be done serverside.

Copy link
Contributor

@mburdette mburdette Nov 5, 2019

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.

@jsflax
Copy link
Contributor Author

jsflax commented Nov 5, 2019

@mburdette PTAL

Copy link
Contributor

@mburdette mburdette left a 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

@jsflax jsflax merged commit 0c2617d into mongodb:master Nov 5, 2019
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.

3 participants