1 //jshint node:true, eqnull:true
2 /*global describe, it, before*/
5 var esformatter = require('esformatter');
6 var fs = require('fs');
7 var quotes = require('../');
8 var expect = require('chai').expect;
11 describe('compare input/output', function() {
16 input = getFile('input.js');
17 esformatter.register(quotes);
20 describe('single quote', function() {
21 it('should convert to single quotes and normalize escapes', function() {
22 var output = esformatter.format(input, {
27 expect(output).to.be.eql(getFile('output-single.js'));
30 it('should avoid escape', function() {
31 var output = esformatter.format(input, {
37 expect(output).to.be.eql(getFile('output-single-avoid.js'));
41 describe('double quote', function() {
42 it('should convert to double quotes and normalize escapes', function() {
43 var output = esformatter.format(input, {
48 expect(output).to.be.eql(getFile('output-double.js'));
51 it('should avoid escape', function() {
52 var output = esformatter.format(input, {
58 expect(output).to.be.eql(getFile('output-double-avoid.js'));
65 function getFile(name) {
66 return fs.readFileSync('test/compare/' + name).toString();