From 18c7e07da1681d8eed1d56e5f5291cc6b0142c4c Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Mon, 29 Sep 2014 01:03:18 +1000 Subject: [PATCH] add util test --- test/util.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 test/util.js 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")); + }); +});