-
Notifications
You must be signed in to change notification settings - Fork 10
Testing with odk-xpath lib #87
base: master
Are you sure you want to change the base?
Testing with odk-xpath lib #87
Conversation
@vimemo please see comments above. There only seem to be a few important tests remaining. Most are not important. I'm guessing many of these tests have the same fix. Very cool! 👍 |
hi @MartijnR, I am not able to see your comments for some reason. Am I missing something? |
Sorry @vimemo! I forgot to click 'Submit Review'. Thankfully they were saved... |
test/spec/functions-openrosa.spec.js
Outdated
console.error( 'Could not parse JSON from', curValue ); | ||
} | ||
|
||
return new g.win.XPathJS.customXPathFunction.type.StringType( status ); |
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.
That looks good. Feel free to change more if e.g. XPathJS.customXPathFunction.type.StringType
is an awkward solution in your library. Will you have some documentation on how to add custom functions in your library?
} ); | ||
} ); | ||
|
||
|
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.
Unfortunately, I don't think we can do asynchronous functions in XPath. I am also not very enthusiastic about adding a large library to do this synchronously, so I'm wondering if we should just forget about supporting digest()
. It's quite an obscure function.
We do include a library in enketo-express called node-forge
to encrypt submissions, which if used in odk-xpath would not increase the size (if the versions are in sync?) in Enketo Express. Not sure if that would support synchronous digest generation.
expect( result.stringValue ).to.have.length( 36 ); | ||
|
||
result = g.doc.evaluate( 'uuid(6)', g.doc, null, g.win.XPathResult.STRING_TYPE ); | ||
expect( result.stringValue ).to.have.length( 6 ); |
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.
There is no particular format requirement, so this should be good! Fyi, this is the ODK Collect code: https://github.com/opendatakit/javarosa/blob/59611cc0755dfbaf6631866ff15d6a9a516df704/src/main/java/org/javarosa/core/util/PropertyUtils.java#L54
No description provided.