<commit_before>/* eslint-env mocha */

import { expect } from 'chai'
import fs from 'fs-extra'
import images from 'images'
import glob from 'glob'

import './css-plugin'

describe('utils - psd', function() {
    before(function() {
        fs.emptyDirSync('test/tmp')
        process.chdir('test/tmp')
    })

    after(function() {
        process.chdir('../..')
    })

    let psd = require('../src/utils/psd').default

    it('should works with group', function() {
        let opt = {
            src: 'group/',
            psd: '../fixtures/keyframes.psd'
        }

        let {_ret, rewriteOption} = psd.process(opt)
        expect(rewriteOption.src).to.contain('/.lia/*')
        expect(_ret.psd.size.width).to.equal(256)
        expect(_ret.psd.size.height).to.equal(512)
        expect(_ret.items).to.have.lengthOf(4)

        _ret.items.forEach((item, index) => {
            let {output, ...prop} = item
            expect(prop).to.deep.equal({
                name: `${index + 1}`,
                top: 128,
                left: 0,
                right: 256,
                bottom: 384,
                size: {
                    width: 256,
                    height: 256
                }
            })
            expect(images(output).size().width).to.equal(256)
            expect(images(output).size().height).to.equal(256)
        })
    })

    it('should works with layer', function() {
        let opt = {
            src: '{1,2,3}',
            psd: '../fixtures/keyframes.psd'
        }

        let {_ret, rewriteOption} = psd.process(opt)
        expect(rewriteOption.src).to.contain('/.lia/*')
        expect(_ret.psd.size.width).to.equal(256)
        expect(_ret.psd.size.height).to.equal(512)
        expect(_ret.items).to.have.lengthOf(6)

        let exp = [{
            name: '1',
            top: 128,
            left: 0,
            right: 100,
            bottom: 228,
            size: {<commit_msg>update test<commit_after>/* eslint-env mocha */

import { expect } from 'chai'
import fs from 'fs-extra'
import images from 'images'
import glob from 'glob'
import path from 'path'

import './css-plugin'

describe('utils - psd', function() {
    before(function() {
        fs.emptyDirSync('test/tmp')
        process.chdir('test/tmp')
    })

    after(function() {
        process.chdir('../..')
    })

    let psd = require('../src/utils/psd').default

    it('should works with group', function() {
        let opt = {
            src: 'group/',
            psd: '../fixtures/keyframes.psd'
        }

        let {_ret, rewriteOption} = psd.process(opt)
        expect(rewriteOption.src).to.contain(path.normalize('/.lia/*'))
        expect(_ret.psd.size.width).to.equal(256)
        expect(_ret.psd.size.height).to.equal(512)
        expect(_ret.items).to.have.lengthOf(4)

        _ret.items.forEach((item, index) => {
            let {output, ...prop} = item
            expect(prop).to.deep.equal({
                name: `${index + 1}`,
                top: 128,
                left: 0,
                right: 256,
                bottom: 384,
                size: {
                    width: 256,
                    height: 256
                }
            })
            expect(images(output).size().width).to.equal(256)
            expect(images(output).size().height).to.equal(256)
        })
    })

    it('should works with layer', function() {
        let opt = {
            src: '{1,2,3}',
            psd: '../fixtures/keyframes.psd'
        }

        let {_ret, rewriteOption} = psd.process(opt)
        expect(rewriteOption.src).to.contain(path.normalize('/.lia/*'))
        expect(_ret.psd.size.width).to.equal(256)
        expect(_ret.psd.size.height).to.equal(512)
        expect(_ret.items).to.have.lengthOf(6)

        let exp = [{
            name: '1',
            top: 128,
            left: 0,
            right: 100,
            bottom: 228,
            size: {
{'fraction_non_alphanumeric': 0.15914850481500253, 'fraction_numerical': 0.025848960973137353, 'mean_word_length': 1.559662775616083, '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': '775316', 'n_tokens_mistral': 1323, 'n_tokens_neox': 1208, 'n_words': 221}