diff options
Diffstat (limited to 'jstests/core/list_commands.js')
-rw-r--r-- | jstests/core/list_commands.js | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/jstests/core/list_commands.js b/jstests/core/list_commands.js index 0eadce58507..cfda8f0d91c 100644 --- a/jstests/core/list_commands.js +++ b/jstests/core/list_commands.js @@ -1,39 +1,39 @@ // Test for listCommands. (function() { - "use strict"; +"use strict"; - var commands = db.runCommand({listCommands: 1}); - assert.commandWorked(commands); +var commands = db.runCommand({listCommands: 1}); +assert.commandWorked(commands); - // Test that result is sorted. - function isSorted(obj) { - var previousProperty; - for (var property in obj["commands"]) { - if (previousProperty && (previousProperty > property)) { - return false; - } - previousProperty = property; +// Test that result is sorted. +function isSorted(obj) { + var previousProperty; + for (var property in obj["commands"]) { + if (previousProperty && (previousProperty > property)) { + return false; } - return true; + previousProperty = property; } - assert(isSorted(commands)); + return true; +} +assert(isSorted(commands)); - // Test that result contains basic commands. - assert(commands.hasOwnProperty("commands")); - assert(commands["commands"].hasOwnProperty("isMaster")); - assert(commands["commands"].hasOwnProperty("insert")); - assert(commands["commands"].hasOwnProperty("ping")); +// Test that result contains basic commands. +assert(commands.hasOwnProperty("commands")); +assert(commands["commands"].hasOwnProperty("isMaster")); +assert(commands["commands"].hasOwnProperty("insert")); +assert(commands["commands"].hasOwnProperty("ping")); - // Test that commands listed have required properties - const isMaster = commands["commands"]["isMaster"]; - assert(isMaster.hasOwnProperty("help")); - assert(isMaster.hasOwnProperty("slaveOk")); - assert(isMaster.hasOwnProperty("adminOnly")); - assert(isMaster.hasOwnProperty("requiresAuth")); +// Test that commands listed have required properties +const isMaster = commands["commands"]["isMaster"]; +assert(isMaster.hasOwnProperty("help")); +assert(isMaster.hasOwnProperty("slaveOk")); +assert(isMaster.hasOwnProperty("adminOnly")); +assert(isMaster.hasOwnProperty("requiresAuth")); - // Test that requiresAuth outputs correct value - const insert = commands["commands"]["insert"]; - assert(isMaster["requiresAuth"] === false); - assert(insert["requiresAuth"] === true); +// Test that requiresAuth outputs correct value +const insert = commands["commands"]["insert"]; +assert(isMaster["requiresAuth"] === false); +assert(insert["requiresAuth"] === true); })(); |