These are tested separately, for performance testing reasons
send::
msg test.util.todayjs
expect:: (payload ~= "....-..-.."
)
send::
msg test.util.addMonths (mths:Number=1
)
expect:: (payload ~= "....-..-.."
)
send::
msg ctx.set (payload)
expect:: (payload contains "UTC"
)$ifc:: NOT (diesel[="isLocaldevbox"])
expect:: (payload is Exception
)$ifc:: diesel[="isLocaldevbox"]
send::
msg ctx.set (res5)
expect:: (res5 not empty
)
send::
msg ctx.set (res139)
expect:: (res139 not empty
)
send::
msg ctx.set (res144)
expect:: (res144 not empty
)
These are not used:
send::
msg ctx.set (a:Number=1
, b:Number=2
)
The input parameters overwrite context above
send::
msg expr.js.sum1 (a:Number=1
, b:Number=2
)
expect:: (res39 is 3
)
send::
msg expr.js.sum2 (a:Number=1
, b:Number=2
)
expect:: (res42 is 3.0
)
send::
msg expr.js.name1 (email="jane@doe.com"
)
expect:: (res40 is "jane"
)
/$send ctx.setVal (name="cart", value={})
send::
msg expr.js.validateEmail (email="jane@doe.com"
)
expect:: (ok25 is true
)
send::
msg ctx.set (ok25:Boolean)
send::
msg expr.js.validateEmail (email="janedoe.com"
)
expect:: (ok25 is false
)
Simple javascript - script is independent (no arguments):
send::
msg ctx.set (a225)
expect:: (a225 is 5
)
Escaping quotes with javascript regex (notice a230 available inside the js expression):
val a230="{"a":32}"
="{"a":32}"
send::
msg ctx.set (a231)
expect:: (a231 is "{"a":32}"
)
More JS examples:
send::
msg ctx.set (now)
send::
msg ctx.set (later)
send::
msg ctx.set (later)
send::
msg ctx.set (noweh, later)
send::
msg ctx.set (res57="1
2
3
"
)
Convert to string and use a JS expression for filter lambda
send::
msg ctx.set (a298 :Array)
send::
msg ctx.echo (res299)
expect:: (res299 is ["1"]
)
You need to log in to post a comment!