diff options
| author | Stephen Blott | 2014-10-26 17:28:21 +0000 | 
|---|---|---|
| committer | Stephen Blott | 2014-10-26 17:28:21 +0000 | 
| commit | aa2b4eb5447e225179d0d2037f124bf94b4f1492 (patch) | |
| tree | 2772c871d8f3f7e6338fde6fc8b69cfc2339882e | |
| parent | 061647b61193ae0f2ccf6a87cc913e2ab67dc949 (diff) | |
| parent | c391b7777ccf7b2445193fbb39656d9c28be3f75 (diff) | |
| download | vimium-aa2b4eb5447e225179d0d2037f124bf94b4f1492.tar.bz2 | |
Merge pull request #1197 from smblott-github/command-option-tests
Add tests to validate command structures.
| -rw-r--r-- | tests/unit_tests/commands_test.coffee | 27 | 
1 files changed, 27 insertions, 0 deletions
| diff --git a/tests/unit_tests/commands_test.coffee b/tests/unit_tests/commands_test.coffee index 99e0e444..7a1b43ab 100644 --- a/tests/unit_tests/commands_test.coffee +++ b/tests/unit_tests/commands_test.coffee @@ -8,3 +8,30 @@ context "Key mappings",      assert.equal (Commands.normalizeKey '<C-A>'), '<c-A>'      assert.equal (Commands.normalizeKey '<F12>'), '<f12>'      assert.equal (Commands.normalizeKey '<C-F12>'), '<c-f12>' + +context "Validate commands and options", +  should "have either noRepeat or repeatLimit, but not both", -> +    for command, options of Commands.availableCommands +      assert.isTrue not (options.noRepeat and options.repeatLimit) + +  should "have a description for each command", -> +    for command, options of Commands.availableCommands +      assert.equal 'string', typeof options.description + +  should "have valid commands for each command in each command group", -> +    for group, commands of Commands.commandGroups +      for command in commands +        assert.equal 'string', typeof command +        assert.isTrue Commands.availableCommands[command] + +  should "have valid commands for each advanced command", -> +    for command in Commands.advancedCommands +      assert.equal 'string', typeof command +      assert.isTrue Commands.availableCommands[command] + +  should "have valid commands for each default key mapping", -> +    count = Object.keys(Commands.keyToCommandRegistry).length +    assert.isTrue (0 < count) +    for key, command of Commands.keyToCommandRegistry +      assert.equal 'object', typeof command +      assert.isTrue Commands.availableCommands[command.command] | 
