clean up and fix tests
This commit is contained in:
@@ -1,20 +1,20 @@
|
||||
var generate = require("../lib/6to5/generator");
|
||||
var traverse = require("../lib/6to5/traverse");
|
||||
var assert = require("assert");
|
||||
var helper = require("./_helper");
|
||||
var util = require("../lib/6to5/util");
|
||||
var chai = require("chai");
|
||||
var t = require("../lib/6to5/types");
|
||||
var _ = require("lodash");
|
||||
|
||||
suite("generation", function () {
|
||||
test("completeness", function () {
|
||||
_.each(traverse.VISITOR_KEYS, function (keys, type) {
|
||||
_.each(t.VISITOR_KEYS, function (keys, type) {
|
||||
assert.ok(!!generate.CodeGenerator.prototype[type], type + " should exist");
|
||||
});
|
||||
|
||||
_.each(generate.CodeGenerator.prototype, function (fn, type) {
|
||||
if (!/[A-Z]/.test(type[0])) return;
|
||||
assert.ok(traverse.VISITOR_KEYS[type], type + " should not exist");
|
||||
assert.ok(t.VISITOR_KEYS[type], type + " should not exist");
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -26,7 +26,7 @@ _.each(helper.get("generation"), function (testSuite) {
|
||||
var expect = task.expect;
|
||||
var actual = task.actual;
|
||||
|
||||
var actualAst = util.parseNoProperties(actual.loc, actual.code);
|
||||
var actualAst = util.parse({ filename: actual.loc }, actual.code);
|
||||
var actualCode = generate(actual.code, actualAst).code;
|
||||
|
||||
chai.expect(actualCode).to.equal(expect.code, actual.loc + " !== " + expect.loc);
|
||||
|
||||
Reference in New Issue
Block a user