summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough/shell_assertions.js
diff options
context:
space:
mode:
authorIan Boros <ian.boros@10gen.com>2018-08-22 12:49:05 -0400
committerIan Boros <ian.boros@10gen.com>2018-08-22 18:33:32 -0400
commit2bed54b084995f2c2dd048b6a70b6fd678e1ac30 (patch)
treed74967637c51d171406ba4be912abdc3eca419b6 /jstests/noPassthrough/shell_assertions.js
parent6dd6e4d307c54912f6aaa502a581af9cb9dbf055 (diff)
downloadmongo-2bed54b084995f2c2dd048b6a70b6fd678e1ac30.tar.gz
SERVER-36774 Allow shell assertion functions to take an object for the 'msg'
Diffstat (limited to 'jstests/noPassthrough/shell_assertions.js')
-rw-r--r--jstests/noPassthrough/shell_assertions.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/jstests/noPassthrough/shell_assertions.js b/jstests/noPassthrough/shell_assertions.js
index 8915d087a3e..88fdcaa79ab 100644
--- a/jstests/noPassthrough/shell_assertions.js
+++ b/jstests/noPassthrough/shell_assertions.js
@@ -133,6 +133,25 @@
assert.eq(true, called, 'called should not have been udpated');
});
+ tests.push(function assertShouldAcceptObjectAsMsg() {
+ const objMsg = {someMessage: 1};
+ const err = assert.throws(() => {
+ assert(false, objMsg);
+ });
+
+ assert.neq(-1,
+ err.message.indexOf(tojson(objMsg)),
+ 'Error message should have included ' + tojson(objMsg));
+ });
+
+ tests.push(function assertShouldNotAcceptNonObjStringFunctionAsMsg() {
+ const err = assert.throws(() => {
+ assert(true, 1234);
+ });
+
+ assert.neq(-1, err.message.indexOf("msg parameter must be a "));
+ });
+
/* assert.automsg tests */
tests.push(function automsgShouldPassToAssert() {