-
Notifications
You must be signed in to change notification settings - Fork 24
refactor: rename clients.AuthInterface() to clients.Auth() #81
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
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #81 +/- ##
=======================================
Coverage 63.16% 63.16%
=======================================
Files 210 210
Lines 22186 22186
=======================================
+ Hits 14013 14014 +1
+ Misses 7087 7083 -4
- Partials 1086 1089 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
mwbrooks
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.
🎏 A few notes to keep the reviewers company during the long scroll down...
| clientsMock.AddDefaultMocks() | ||
|
|
||
| clientsMock.AuthInterface.On("ResolveAPIHost", mock.Anything, mock.Anything, mock.Anything). | ||
| clientsMock.Auth.On("ResolveAPIHost", mock.Anything, mock.Anything, mock.Anything). |
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.
note: Updating our mocks to clientsMock.Auth
| // promptTeamSlackAuth retrieves an authenticated team from input | ||
| func promptTeamSlackAuth(ctx context.Context, clients *shared.ClientFactory) (*types.SlackAuth, error) { | ||
| allAuths, err := clients.AuthInterface().Auths(ctx) | ||
| allAuths, err := clients.Auth().Auths(ctx) |
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.
note: Updating our client to clients.Auth()
| SDKConfig hooks.SDKCLIConfig | ||
| API func() api.APIInterface | ||
| AppClient func() *app.Client | ||
| Auth func() auth.AuthInterface |
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.
note: This is the main change
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 like that this also removes a space in the struct! 👾 ✨
| // defaultAuthFunc return a new Auth Interface | ||
| func (c *ClientFactory) defaultAuthFunc() auth.AuthInterface { |
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.
note: Updating the constructor's name
| Stdout *bytes.Buffer | ||
| HookExecutor hooks.MockHookExecutor | ||
| API *api.APIMock | ||
| Auth *auth.AuthMock |
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.
note: This is the main change to update the mocks.
zimeg
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.
@mwbrooks Wow! Between this and #77 the code is reading so much better 📚
The motivation is that the name is shorter and more accurate.
To me this change also makes more sense since I'm often just wanting to call a method from clients and expect it to be through an interface 😉
Thank you yet again for the care of this code 😌 🎉
| SDKConfig hooks.SDKCLIConfig | ||
| API func() api.APIInterface | ||
| AppClient func() *app.Client | ||
| Auth func() auth.AuthInterface |
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 like that this also removes a space in the struct! 👾 ✨
|
Thanks for the quick review @zimeg! ❤️ I think we have many more changes like this, but it's nice to see the |
Summary
This pull request follows #77 by updating
clients.AuthInterface()toclients.Auth().The motivation is that the name is shorter and more accurate. The
clients.Auth()returns an instance ofauth.Clientthat implements theauth.AuthInterfaceinterface. It doesn't return an interface.There was no change functionality was changed, but our mocks were updated to match the same naming pattern.
Requirements