<commit_before>import path from 'path'
import assert from 'assert'
import SpriteImage from '../src'
import message from '../src/message'

let sprite = path.resolve(__dirname, '../static/sprite')

let spriteImage = new SpriteImage({
  imgdir: '../../img',
  cssdir: '../../css',
  cssimg: '../img'
})

describe('spriteImage.generate', () => {
  it(message.PATH_NULL, () => {
    assert.throws(() => {
      spriteImage.generate()
    }, err => {
      return err.toString().includes(message.PATH_NULL)
    })
  })

  it(message.PATH_NOT_STRING, () => {
    assert.throws(() => {
      spriteImage.generate(true)
    }, err => {
      return err.toString().includes(message.PATH_NOT_STRING)
    })
  })

  it(message.PATH_ERROR, () => {
    assert.throws(() => {
      spriteImage.generate('string')
    }, err => {
      return err.toString().includes(message.PATH_ERROR)
    })
  })

  it(message.PATH_NOT_EXISTS, () => {
    assert.throws(() => {
      spriteImage.generate(path.join(__dirname, 'not_exists'))
    }, err => {
      return err.toString().includes(message.PATH_NOT_EXISTS)
    })
  })

  it(message.CONFIG_ERROR, () => {
    assert.throws(() => {
      spriteImage.generate(path.join(sprite, 'watch'), [])
    }, err => {
      return err.toString().includes(message.CONFIG_ERROR)
    })
  })

  it('生成图标', () => {
    assert.doesNotThrow(() => {
      spriteImage.generate(path.join(sprite, 'icon'))
    })
  })

  it('生成执行一次动画的手表', () => {
    assert.doesNotThrow(() => {
      spriteImage.generate(path.join(sprite, 'watch'), {
        outext: 'jpg',
        keyframe: {
          width: 348,
          height: 448
        }
      })
    })
  })

  it('生成循环执行动画的猪仔', () => {
    assert.doesNotThrow(() => {
      spriteImage.generate(path.join(sprite, 'piglet'), {
        keyframe: {
          infinite: true,
          width: 240,
          height: 240
        }
      })
    })
  })
})<commit_msg>调整测试用例<commit_after>import path from 'path'
import assert from 'assert'
import SpriteImage from '../src'
import message from '../src/message'

let sprite = path.resolve(__dirname, '../static/sprite')

let spriteImage = new SpriteImage({
  imgdir: '../../img',
  cssdir: '../../css',
  cssimg: '../img'
})

describe('spriteImage.generate', () => {
  it('合成图标并生成CSS', () => {
    assert.doesNotThrow(() => {
      spriteImage.generate(path.join(sprite, 'icon'))
    })
  })

  it('合成序列帧并生成CSS：执行一次动画', () => {
    assert.doesNotThrow(() => {
      spriteImage.generate(path.join(sprite, 'watch'), {
        outext: 'jpg',
        keyframe: {
          width: 348,
          height: 448
        }
      })
    })
  })

  it('合成序列帧并生成CSS：循环执行动画', () => {
    assert.doesNotThrow(() => {
      spriteImage.generate(path.join(sprite, 'piglet'), {
        keyframe: {
          infinite: true,
          width: 240,
          height: 240
        }
      })
    })
  })
})
{'fraction_non_alphanumeric': 0.19250780437044746, 'fraction_numerical': 0.008324661810613945, 'mean_word_length': 2.381008206330598, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 32, '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': '7608123', 'n_tokens_mistral': 1030, 'n_tokens_neox': 1007, 'n_words': 146}