UNPKG

@unibeautify/beautifier-prettydiff

Version:
39 lines 1.33 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const unibeautify_1 = require("unibeautify"); const src_1 = require("../../src"); const options_1 = require("../../src/options"); test(`should successfully beautify JavaScript through auto lang select`, () => { const unibeautify = unibeautify_1.newUnibeautify(); const testLanguage = { atomGrammars: [], extensions: ["test"], name: "TestLanguage", namespace: "test", since: "0.1.0", sublimeSyntaxes: [], vscodeLanguages: [], }; unibeautify.loadLanguage(testLanguage); const testBeautifier = Object.assign({}, src_1.default, { options: { [testLanguage.name]: options_1.default.Common, } }); unibeautify.loadBeautifier(testBeautifier); const text = `function test(){console.log('hello world');}`; const beautifierResult = `function test() {\n\tconsole.log('hello world');\n}`; return unibeautify .beautify({ languageName: testLanguage.name, options: { TestLanguage: { indent_style: "tab", indent_size: 1, }, }, text, }) .then(results => { expect(results).toBe(beautifierResult); }); }); //# sourceMappingURL=auto.spec.js.map