diff options
Diffstat (limited to 'jstests/noPassthrough/shell_assertions.js')
-rw-r--r-- | jstests/noPassthrough/shell_assertions.js | 19 |
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() { |