1 | "use strict";
|
2 | var grunt = require("grunt"),
|
3 | exec = require("child_process").exec;
|
4 |
|
5 | (function() {
|
6 |
|
7 | function beautifyAndassert(test, task, actualFile, expectedFile) {
|
8 | exec("grunt " + task, function(error, stdout, stderr) {
|
9 | var actual = grunt.file.read("tmp/fileMapping/" + actualFile),
|
10 | expected = grunt.file.read("tmp/fileMapping/" + expectedFile);
|
11 | test.equal(actual, expected, "should beautify js " + actualFile + " using config file");
|
12 | test.done();
|
13 | });
|
14 | }
|
15 |
|
16 | exports["fileMapping_test"] = {
|
17 | "beautification of js file using file mapping": function(test) {
|
18 | test.expect(1);
|
19 | beautifyAndassert(test, "jsbeautifier:fileMapping", "not-beautified.js.erb", "expected/beautified.js.erb");
|
20 | },
|
21 | "beautification of css file using file mapping": function(test) {
|
22 | test.expect(1);
|
23 | beautifyAndassert(test, "jsbeautifier:fileMapping", "not-beautified.css.erb", "expected/beautified.css.erb");
|
24 | },
|
25 | "beautification of html file using file mapping": function(test) {
|
26 | test.expect(1);
|
27 | beautifyAndassert(test, "jsbeautifier:fileMapping", "not-beautified.html.erb", "expected/beautified.html.erb");
|
28 | }
|
29 | };
|
30 | })();
|