Ilya - I'm working on converting the quote-props test, and the first
invalid test uses an assert on the messages[0].node.key.name -- which is
not part of the mocha-wrapper.

However, I'm thinking it may be a pointless test, as the node.key.name is
quoted inside of the message, which is explicitly tested.

Does that seem correct?

vows test:

    "when evaluating `var x = { foo: 42 }`": {

        topic: "var x = { foo: 42 }",

        "should report a violation": function(topic) {

            var config = { rules: {} };
            config.rules[RULE_ID] = 1;

            var messages = eslint.verify(topic, config);

            assert.equal(messages.length, 1);
            assert.equal(messages[0].ruleId, RULE_ID);
            assert.equal(messages[0].message,* "Non-quoted property `foo`
found."*);
            assert.include(messages[0].node.type, "Property");
            *assert.include(messages[0].node.key.name
<http://node.key.name>, "foo");*
        }
    }


mocha DRY conversion:

        { code: "var x = { foo: 42 }",
          errors: [{ message: *"Non-quoted property `foo` found."*, type:
"Property"}] }


OR should the following part of eslintTester.js be extended to check for
node.type.name ?

if (messages.length === errors.length) {
    for (var i=0, l=errors.length; i<l; i++) {
        assert.equal(messages[i].ruleId, ruleName, "Error rule name should
be the same as the name of the rule being tested");
        if (errors[i].message) {
            assert.equal(messages[i].message, errors[i].message, "Error
message should be " + errors[i].message);
        }
        if (errors[i].type) {
            assert.equal(messages[i].node.type, errors[i].type, "Error type
should be " + errors[i].type);
        }
        *// eg similar check for errors[i].name look
atmessages[i].node.key.name <http://node.key.name> *
    }
}

-Michael Paulukonis
http://www.xradiograph.com
Interference Patterns (a blog) <http://www.xradiograph.com%5Cinterference>
@XraysMonaLisa <https://twitter.com/XraysMonaLisa>
http://michaelpaulukonis.com


Sent from somewhere in the Cloud
(hearthrug, by the fender)

-- 
You received this message because you are subscribed to the Google Groups 
"ESLint" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to