summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough/shell_assertions.js
diff options
context:
space:
mode:
authorDavid Bradford <david.bradford@mongodb.com>2018-02-20 10:59:52 -0500
committerDavid Bradford <david.bradford@mongodb.com>2018-02-20 10:59:52 -0500
commit13b35bc5cfb20be89eb46dc50208d344caf305bb (patch)
treede3c630a8c4b50032a0bccea517a226e23400708 /jstests/noPassthrough/shell_assertions.js
parentf159e5bae15513c24a2e9dbc953ce4988ea4be53 (diff)
downloadmongo-13b35bc5cfb20be89eb46dc50208d344caf305bb.tar.gz
SERVER-32393 Use same comparison for eq and neq assertions
Diffstat (limited to 'jstests/noPassthrough/shell_assertions.js')
-rw-r--r--jstests/noPassthrough/shell_assertions.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/jstests/noPassthrough/shell_assertions.js b/jstests/noPassthrough/shell_assertions.js
index 299dbc00d53..75a0a7ee47e 100644
--- a/jstests/noPassthrough/shell_assertions.js
+++ b/jstests/noPassthrough/shell_assertions.js
@@ -182,6 +182,15 @@
assert.eq(true, called, 'msg function should have been called');
});
+ tests.push(function eqShouldPassOnObjectsWithSameContent() {
+ const a = {'foo': true};
+ const b = {'foo': true};
+
+ assert.doesNotThrow(() => {
+ assert.eq(a, b);
+ }, [], 'eq should not throw exception on two objects with the same content');
+ });
+
/* assert.eq.automsg tests */
tests.push(function eqAutomsgShouldCreateMessage() {
@@ -207,6 +216,15 @@
});
});
+ tests.push(function neqShouldFailOnObjectsWithSameContent() {
+ const a = {'foo': true};
+ const b = {'foo': true};
+
+ assert.throws(() => {
+ assert.neq(a, b);
+ }, [], 'neq should throw exception on two objects with the same content');
+ });
+
/* assert.hasFields tests */
tests.push(function hasFieldsRequiresAnArrayOfFields() {