-
Notifications
You must be signed in to change notification settings - Fork 17
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
fixed the assignment of mocked log functions in plugin_test.js #143
Conversation
Looks like the 14.x build failed, any ideas on what the issue is? |
I ran |
I think the issue is occurring on line 28 of test not line 30 as the CI output suggests. It looks to be the test is acting a bit non deterministically in regards to the sleep. kong-js-pdk/__tests__/pluing.test.js Line 28 in e1e49be
|
I think if |
I have added the changes to the pluing.test.js as part of this PR. The changes moves the sleep from line 24 to below line 12. |
I think I need a reapprove to get the CI runners going again. |
Looks good! Thanks for the quick fix for test as well! @dwoctor |
@fffonion Thanks for approving and merging this change quickly. Is there going to be a release soon? |
I will create a patch release tomorrow @dwoctor , it will be 0.5.3. |
@fffonion Thanks. |
@dwoctor it's now released! |
@fffonion Thank you. |
* fixed the assignment of mocked log functions in plugin_test.js * removed semicolon to match style * moved the sleep in pluing.test.js to get desired behaviour
I was writing tests for a Kong JS Plugin, and encountered
Error: function kong.log.err is not a valid PDK function
whenever the plugin tried to interact withawait kong.log.err("insert-error-here");
.After looking into the code, I found the
mockFunctions
inplugin_test.js
where assigned under the index not the value of the elements inlogFunctions
.I traced the issue to the for-in loop the returning the index not the value of the elements of
logFunctions
.In this PR the assignment has been changed to use the name and not the index by using a basic for loop.
I hope these changes are good enough to be merged into the mainline.
If not the feedback would be appreciated.