miscellaneous enhancements to createChooseFn#724
miscellaneous enhancements to createChooseFn#724rossiam merged 1 commit intoSmartThingsCommunity:yargsfrom
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.
Oops, yeah, I've added that test now.
|
|
||
| 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.
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.
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
createChooseFncleanupAPICommandinstead ofSmartThingsClientwhich allows functions access to things inAPICommand(andSmartThingsCommand) like the loggertypeto imports here and there that I noticed were missing itcreateChooseFnwas not using the passed-inlistItemsfunctioncreateChooseFn