<commit_before>'use strict';

var fs = require('fs');
var should = require('chai').should();
var cssesc = require('cssesc');
var Handlebars = require('handlebars');
var prettydiff = require('prettydiff');

Handlebars.registerHelper('cssesc', function (value) {
  return value && value.length > 0 ? cssesc(value, {isIdentifier: true}) : '';
});

Handlebars.registerHelper('escimage', function (img) {
  return img.replace(/['"\(\)\s]/g, function encodeCssUri (chr) {
    return '%' + chr.charCodeAt(0).toString(16);
  });
});

require('mocha');

var lessProc = require('../index');

var fixture = [{
  name: 'default',
  classname: 'icon',
  layout: {
    width: 520,
    height: 656,
    items: [{
      height: 136,
      width: 136,
      x: 0,
      y: 0,
      meta: {
        type: 'png',
        contents: fs.readFileSync('test/fixtures/png.png'),
        fileName: 'png.png',
        name: 'png',
        height: 128,
        width: 128
      }
    }, {
      height: 520,
      width: 520,
      x: 0,
      y: 136,
      meta: {
        type: 'jpg',
        contents: fs.readFileSync('test/fixtures/jpg.jpg'),
        fileName: 'jpg.jpg',
        name: 'jpg',
        height: 512,
        width: 512
      }
    }]
  },
  sprites: [{
    name: 'sprite',
    url: '../images/sprite.png',
    type: 'png',
    dpi: null,
    ratio: null,
    width: 520,
    height: 656
  }]
}];

describe('sprity-less', function () {
  it('should be beautifyable', function () {
    lessProc.isBeautifyable({}).should.be.true;
  });
  it('should return less as the extension', function () {
    lessProc.extension({}).should.equal('less');
  });
  it('should return the correct less', function (done) {
    lessProc.process(fixture, {}, Handlebars)
      .then(function (s) {
        var style = prettydiff.api({
          source: s,
          lang: 'css',
          mode: 'beautify'
        })[0];
        fs.writeFileSync('test/expected/style.less', style, {encoding: 'utf-8'});
        style.should.equal(fs.readFileSync('test/expected/style.less').toString());
        done();
      });
  });
});<commit_msg>remove less writting in test<commit_after>'use strict';

var fs = require('fs');
var should = require('chai').should();
var cssesc = require('cssesc');
var Handlebars = require('handlebars');
var prettydiff = require('prettydiff');

Handlebars.registerHelper('cssesc', function (value) {
  return value && value.length > 0 ? cssesc(value, {isIdentifier: true}) : '';
});

Handlebars.registerHelper('escimage', function (img) {
  return img.replace(/['"\(\)\s]/g, function encodeCssUri (chr) {
    return '%' + chr.charCodeAt(0).toString(16);
  });
});

require('mocha');

var lessProc = require('../index');

var fixture = [{
  name: 'default',
  classname: 'icon',
  layout: {
    width: 520,
    height: 656,
    items: [{
      height: 136,
      width: 136,
      x: 0,
      y: 0,
      meta: {
        type: 'png',
        contents: fs.readFileSync('test/fixtures/png.png'),
        fileName: 'png.png',
        name: 'png',
        height: 128,
        width: 128
      }
    }, {
      height: 520,
      width: 520,
      x: 0,
      y: 136,
      meta: {
        type: 'jpg',
        contents: fs.readFileSync('test/fixtures/jpg.jpg'),
        fileName: 'jpg.jpg',
        name: 'jpg',
        height: 512,
        width: 512
      }
    }]
  },
  sprites: [{
    name: 'sprite',
    url: '../images/sprite.png',
    type: 'png',
    dpi: null,
    ratio: null,
    width: 520,
    height: 656
  }]
}];

describe('sprity-less', function () {
  it('should be beautifyable', function () {
    lessProc.isBeautifyable({}).should.be.true;
  });
  it('should return less as the extension', function () {
    lessProc.extension({}).should.equal('less');
  });
  it('should return the correct less', function (done) {
    lessProc.process(fixture, {}, Handlebars)
      .then(function (s) {
        var style = prettydiff.api({
          source: s,
          lang: 'css',
          mode: 'beautify'
        })[0];
        style.should.equal(fs.readFileSync('test/expected/style.less').toString());
        done();
      });
  });
});
{'fraction_non_alphanumeric': 0.181928001932834, 'fraction_numerical': 0.022952403962309735, 'mean_word_length': 2.4615384615384617, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4959314', 'n_tokens_mistral': 1453, 'n_tokens_neox': 1360, 'n_words': 304}