diff --git a/test/util.js b/test/util.js new file mode 100644 index 0000000000..40e7b647ed --- /dev/null +++ b/test/util.js @@ -0,0 +1,27 @@ +var assert = require("assert"); +var util = require("../lib/6to5/util"); + +suite("util", function () { + test("duplicate mutator map", function () { + var map = { + test: { + get: {} + } + }; + + assert.throws(function () { + util.pushMutatorMap(map, "test", "get", {}); + }, /a get already exists for this property/); + }); + + test("can compile", function () { + assert.ok(util.canCompile("test.js")); + assert.ok(util.canCompile("/test.js")); + assert.ok(util.canCompile("/scripts/test.js")); + + assert.ok(!util.canCompile("test")); + assert.ok(!util.canCompile("test.css")); + assert.ok(!util.canCompile("/test.css")); + assert.ok(!util.canCompile("/scripts/test.css")); + }); +});