marklogic-community / marklogic-unit-test

Automated testing for MarkLogic
https://marklogic-community.github.io/marklogic-unit-test/
Other
13 stars 25 forks source link

test.assertTrue(null) = success #112

Closed aclavio closed 1 year ago

aclavio commented 4 years ago

The assert-true function reports success when passed a null, undefined, or empty sequence (xqy). This feels particularly egregious in SJS as it doesn't adhere to javascripts concept of "truthiness".

(: xqy :)
test:assert-true(())
// sjs
test.assertTrue(null);
test.assertTrue(undefined);
jamesagardner commented 4 years ago

I wonder if it makes sense to introduce a /test/testHelper.sjs implementation that either wraps the existing XQuery assertion functions or has JavaScript implementations that better match with JavaScript idioms.

rjrudin commented 1 year ago

Will see if we can do something useful in 1.4 for this - starting with the 3 scenarios in the original ticket.

dmcassel commented 1 year ago

I wonder if it makes sense to introduce a /test/testHelper.sjs implementation that either wraps the existing XQuery assertion functions or has JavaScript implementations that better match with JavaScript idioms.

I'm in favor of a testHelper.sjs that works with JS idioms. I've run into some challenges with parameters getting passed between languages (discussed in PR155)

rjrudin commented 1 year ago

DEVEXP-552

rjrudin commented 1 year ago

Will be in 1.4.0. See #552.