@unibeautify/beautifier-prettydiff
Version:
Pretty Diff beautifier for Unibeautify
47 lines • 1.68 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const unibeautify_1 = require("unibeautify");
const src_1 = require("../../src");
test(`should successfully beautify JavaScript text with comments indented`, () => {
const unibeautify = unibeautify_1.newUnibeautify();
unibeautify.loadBeautifier(src_1.default);
const text = `function test(n){\n/*this should indent*/return n+1;}`;
const beautifierResult = `function test(n) {\n\t/* this should indent */\n\treturn n + 1;\n}`;
return unibeautify
.beautify({
languageName: "JavaScript",
options: {
JavaScript: {
indent_comments: true,
indent_style: "tab",
indent_size: 1,
},
},
text,
})
.then(results => {
expect(results).toBe(beautifierResult);
});
});
test(`should successfully beautify JavaScript text with comments not indented`, () => {
const unibeautify = unibeautify_1.newUnibeautify();
unibeautify.loadBeautifier(src_1.default);
const text = `function test(n){\n\t/* this should not indent */\n\treturn n + 1;\n}`;
const beautifierResult = `function test(n) {\n/* this should not indent */\n\treturn n + 1;\n}`;
return unibeautify
.beautify({
languageName: "JavaScript",
options: {
JavaScript: {
indent_comments: false,
indent_style: "tab",
indent_size: 1,
},
},
text,
})
.then(results => {
expect(results).toBe(beautifierResult);
});
});
//# sourceMappingURL=indentComments.spec.js.map