<commit_before>var expect = require('chai').expect
var Alchemist = require('../')

/**===========
 * Alchemist *
 ===========**/

describe('Alchemist', function () {
  describe('use()', function () {
    var alchemist, rgb, xyz
    before(function () {
      xyz = { name: 'xyz', from: { }, to: { } }
      rgb = {
        name: 'rgb',
        to: {
          xyz: function () { return 'to xyz from rgb' },
          hsl: function () { return 'to hsl from rgb' }
        },
        from: {
          xyz: function () { return 'from xyz to rgb' },
          hsl: function () { return 'from hsl to rgb' }
        }
      }
      alchemist = Alchemist.create()
      alchemist.use(xyz)
      alchemist.use(rgb)
    })

    it('should create a color space', function () {
      expect(alchemist.spaces).to.exist
      expect(alchemist.spaces).to.have.property('rgb')
      expect(alchemist.spaces.rgb).to.be.an('object')
      expect(alchemist.spaces.rgb).to.have.property('to')
      expect(alchemist.spaces.rgb).to.not.have.property('from')
      expect(alchemist.spaces.rgb.to.xyz).to.be.a('function')
      expect(alchemist.spaces.rgb.to).to.not.have.property('hsl')
    })

    it('should allow a color space to teach another space how to convert to it')

    it('should prefer a local "to" conversion over a foreign "from" conversion')

    it('should store conversions to abstract spaces', function () {
      expect(alchemist.spaces.rgb.to).to.not.have.property('hsl')
      expect(alchemist.spaces.hsl).to.not.exist
      expect(alchemist.abstract_spaces.hsl).to.exist
      expect(alchemist.abstract_spaces.hsl.to.rgb()).to.eq('from hsl to rgb')
      expect(alchemist.abstract_spaces.hsl.from.rgb()).to.eq('to hsl from rgb')
    })
    it('should throw an error when the name is already used by a private method', function () {
      plugin = { name: 'use' }
      expect(alchemist.use.bind(null, plugin)).to.throw(Error)
    })
  })
})

/**=======
 * Color *
 =======**/

describe('Color', function () {
  describe('color()', function () {
    var color, alchemist;
    before(function () {
      color = new Alchemist.Color('rgb', [255, 255, 255])
      alchemist = Alchemist.create()
    })
    it('should have a reference white', function () {
      expect(color.white).to.exist()<commit_msg>still not sure what to do about this<commit_after>var expect = require('chai').expect
var Alchemist = require('../')

/**===========
 * Alchemist *
 ===========**/

describe('Alchemist', function () {
  describe('use()', function () {
    var alchemist, rgb, xyz
    before(function () {
      xyz = { name: 'xyz', from: { }, to: { } }
      rgb = {
        name: 'rgb',
        to: {
          xyz: function () { return 'to xyz from rgb' },
          hsl: function () { return 'to hsl from rgb' }
        },
        from: {
          xyz: function () { return 'from xyz to rgb' },
          hsl: function () { return 'from hsl to rgb' }
        }
      }
      alchemist = Alchemist.create()
      alchemist.use(xyz)
      alchemist.use(rgb)
    })

    it('should create a color space', function () {
      expect(alchemist.spaces).to.exist
      expect(alchemist.spaces).to.have.property('rgb')
      expect(alchemist.spaces.rgb).to.be.an('object')
      expect(alchemist.spaces.rgb).to.have.property('to')
      expect(alchemist.spaces.rgb).to.not.have.property('from')
      expect(alchemist.spaces.rgb.to.xyz).to.be.a('function')
      expect(alchemist.spaces.rgb.to).to.not.have.property('hsl')
    })

    it('should allow a color space to teach another space how to convert to it')

    it('should prefer a local "from" conversion over a foreign "to" conversion')

    it('should store conversions to abstract spaces', function () {
      expect(alchemist.spaces.rgb.to).to.not.have.property('hsl')
      expect(alchemist.spaces.hsl).to.not.exist
      expect(alchemist.abstract_spaces.hsl).to.exist
      expect(alchemist.abstract_spaces.hsl.to.rgb()).to.eq('from hsl to rgb')
      expect(alchemist.abstract_spaces.hsl.from.rgb()).to.eq('to hsl from rgb')
    })
    it('should throw an error when the name is already used by a private method', function () {
      plugin = { name: 'use' }
      expect(alchemist.use.bind(null, plugin)).to.throw(Error)
    })
  })
})

/**=======
 * Color *
 =======**/

describe('Color', function () {
  describe('color()', function () {
    var color, alchemist;
    before(function () {
      color = new Alchemist.Color('rgb', [255, 255, 255])
      alchemist = Alchemist.create()
    })
    it('should have a reference white', function () {
      expect(color.white).to.exist()
{'fraction_non_alphanumeric': 0.1741196802765176, 'fraction_numerical': 0.0038885288399222295, 'mean_word_length': 2.788870703764321, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7021630', 'n_tokens_mistral': 1579, 'n_tokens_neox': 1479, 'n_words': 322}