From 1ab7f9b7f79708171966a4d87154fd655d47ea68 Mon Sep 17 00:00:00 2001 From: Sam Saccone Date: Sun, 2 Dec 2012 17:12:23 -0500 Subject: [PATCH] add real tests! --- package.json | 3 ++- test/test.js | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 test/test.js diff --git a/package.json b/package.json index e8551f2c8..95df7e37c 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,8 @@ "url": "git://github.com/andrew/node-sass.git" }, "scripts": { - "install": "node rebuild.js" + "install": "node rebuild.js", + "test": "mocha test" }, "gypfile": true, "engines": { diff --git a/test/test.js b/test/test.js new file mode 100644 index 000000000..6b99b419f --- /dev/null +++ b/test/test.js @@ -0,0 +1,44 @@ +var sass = require('../sass'); +var assert = require('assert'); + + +var scssStr = '#navbar {\ + width: 80%;\ + height: 23px; }\ + #navbar ul {\ + list-style-type: none; }\ + #navbar li {\ + float: left;\ + a {\ + font-weight: bold; }}'; + +var expectedRender = '#navbar {\n\ + width: 80%;\n\ + height: 23px; }\n\ +\n\ +#navbar ul {\n\ + list-style-type: none; }\n\ +\n\ +#navbar li {\n\ + float: left; }\n\ + #navbar li a {\n\ + font-weight: bold; }\n'; + + +describe("compile scss", function() { + it("should compile", function(done) { + sass.render(scssStr, function(err, css) { + done(err); + }); + }); + + it("should match compiled string", function(done) { + sass.render(scssStr, function(err, css) { + if (!err) { + done(assert.equal(css, expectedRender)); + } else { + done(err); + } + }); + }); +}); \ No newline at end of file