-
Notifications
You must be signed in to change notification settings - Fork 116
miscellaneous enhancements to createChooseFn #724
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
miscellaneous enhancements to createChooseFn #724
Conversation
|
a021d5c
to
8c1b0e1
Compare
expect.objectContaining({ listItems: expect.any(Function) }), | ||
) | ||
|
||
// expect listItemsMock to get called when listItems passed to third argument of selectFromListMock is called |
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.
Is this TODO?
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.
Oops, yeah, I've added that test now.
src/lib/command/util/util-util.ts
Outdated
|
||
if (opts.useConfigDefault) { | ||
if (!createOptions?.defaultValue) { | ||
throw Error('invalid state, choose function called with "useConfigDefault" but no default configured') |
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 not sure if this change would be appropriate for an error message, but it might be easier to parse if it said something like "choose function was called" because it's a little ambiguous whether "choose" is a verb or an adjective here. (I.e., that "choose function" is a type of function, not an instruction)
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.
This is a developer-targeted error message, so anything that makes more sense to us is good. I've changed it to:
invalid state, the choose<Thing> function was called with "useConfigDefault" but no default configured
8c1b0e1
to
7c0b992
Compare
miscellanous
createChooseFn
cleanupAPICommand
instead ofSmartThingsClient
which allows functions access to things inAPICommand
(andSmartThingsCommand
) like the loggertype
to imports here and there that I noticed were missing itcreateChooseFn
was not using the passed-inlistItems
functioncreateChooseFn