-
Notifications
You must be signed in to change notification settings - Fork 164
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
Refactor index.js to have testable functions #2854
Conversation
First export, the onRequest const will be cut into smaller pieces finally have response handlers seperate functions
Cut to minimum peces, then will add the callbacks needed to test return values
Merge #2823 into this branch, so that we can move forward with this, and fix error described here: #2823 (comment) before merging to develop |
- Made hashAndUpload testable - Added a processFiles function to expect a result based on the files array
…passed to processFiles
Created processFileField function
package.json
Outdated
@@ -53,6 +53,7 @@ | |||
"dangerously-set-inner-html": "^2.0.1", | |||
"exports-loader": "^0.7.0", | |||
"inputmask": "^3.3.11", | |||
"jquery": "^3.3.1", |
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.
@New0 Make sure that jQuery is not being bundled (by webapack) should be handled here https://github.com/CalderaWP/Caldera-Forms/blob/master/webpack.config.js#L52)
Also, probably should use 1.12.4 since that's what WordPress uses.
clients/render/fileUploads.js
Outdated
if( response.hasOwnProperty('message') ){ | ||
messages[field.fieldIdAttr] = { | ||
error: true, | ||
message: response.hasOwnProperty('message') ? response.message : 'Invalid' |
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.
@New0 untranslatable string.
clients/render/fileUploads.js
Outdated
} | ||
}; | ||
|
||
export const handleFileUploadError = (error, file) => { |
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.
@New0 Inline docs
clients/render/util.js
Outdated
@@ -1,4 +1,4 @@ | |||
const SparkMD5 = require('spark-md5'); | |||
export const SparkMD5 = require('spark-md5'); | |||
|
|||
export const getFieldConfigBy = (fieldConfigs, findBy, findWhere) => { |
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.
@New0 Inline docs
clients/render/util.js
Outdated
@@ -1,4 +1,4 @@ | |||
const SparkMD5 = require('spark-md5'); | |||
export const SparkMD5 = require('spark-md5'); |
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.
@New0 Why export the dependency?
… -> Values set to three files) that was previously failing
… (Test passes in phpstorm)
Ghost inspector test ( test site CF version set to branch 2818-2 ) https://app.ghostinspector.com/tests/5c3882b70b45715fbf380071 |
@New0 What we said on the call, tests needed in addition to what you have:
For the second 2, enzyme could test that the state does not include the file field when field is not hidden -- I think we have this test, not sure. After that I'll fo final review and MERGE IT 🌋 🌮 🎉 🍰 🌋 |
No description provided.