summaryrefslogtreecommitdiff
path: root/jstests
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
parentf159e5bae15513c24a2e9dbc953ce4988ea4be53 (diff)
downloadmongo-13b35bc5cfb20be89eb46dc50208d344caf305bb.tar.gz
SERVER-32393 Use same comparison for eq and neq assertions
Diffstat (limited to 'jstests')
-rw-r--r--jstests/multiVersion/upgrade_cluster.js2
-rw-r--r--jstests/noPassthrough/shell_assertions.js18
2 files changed, 19 insertions, 1 deletions
diff --git a/jstests/multiVersion/upgrade_cluster.js b/jstests/multiVersion/upgrade_cluster.js
index 4f861ed7860..5769bed44ec 100644
--- a/jstests/multiVersion/upgrade_cluster.js
+++ b/jstests/multiVersion/upgrade_cluster.js
@@ -99,7 +99,7 @@ TestData.skipCheckingUUIDsConsistentAcrossCluster = true;
version = st.s.getCollection('config.version').findOne();
assert.eq(version.minCompatibleVersion, 5);
assert.eq(version.currentVersion, 6);
- assert.neq(clusterID, version.clusterId);
+ assert.eq(clusterID, version.clusterId);
assert.eq(version.excluding, undefined);
st.stop();
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() {