summaryrefslogtreecommitdiff
path: root/jstests/core/list_commands.js
blob: e9c021ff32bb4334bdc75c1de41ca685176c9bfb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Test for listCommands.

(function() {
    "use strict";

    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;
        }
        return true;
    }
    assert(isSorted(commands));

    // Test that result contains basic commands.
    assert(commands.hasOwnProperty("commands"));
    assert(commands["commands"].hasOwnProperty("hello"));
    assert(commands["commands"].hasOwnProperty("isMaster"));
    assert(commands["commands"].hasOwnProperty("insert"));
    assert(commands["commands"].hasOwnProperty("ping"));
})();