<commit_before>"use strict";

var assert = require('assert')
var namer = require('..')

suite('namer', function () {

  test('is a function', function() {
    assert.equal('function', typeof(namer))
  })

  test('returns an object containing named sorted arrays', function() {
    var names = namer('#ffa500')
    assert(!Array.isArray(names))
    assert(names.basic)
    assert(names.html)
    assert(names.ntc)
    assert(names.pantone)
    assert(names.roygbiv)
    assert(names.x11)
    assert.equal(names.basic[0].distance, 0)
  })

  test('matches inexact colors with deltaE', function() {
    var names = namer('FF0001', { distance: 'deltaE' })
    assert.equal(names.basic[0].hex, '#FF0000')
    assert.equal(names.basic[0].name, 'red')
    assert.equal(Math.floor(names.basic[0].distance*100), 13)
  })

  test('matches inexact colors with deltaE', function() {
    var names = namer('FF0001')
    assert.equal(names.basic[0].hex, '#FF0000')
    assert.equal(names.basic[0].name, 'red')
    assert.equal(Math.floor(names.basic[0].distance*100), 25)<commit_msg>Fix test<commit_after>"use strict";

var assert = require('assert')
var namer = require('..')

suite('namer', function () {

  test('is a function', function() {
    assert.equal('function', typeof(namer))
  })

  test('returns an object containing named sorted arrays', function() {
    var names = namer('#ffa500')
    assert(!Array.isArray(names))
    assert(names.basic)
    assert(names.html)
    assert(names.ntc)
    assert(names.pantone)
    assert(names.roygbiv)
    assert(names.x11)
    assert.equal(names.basic[0].distance, 0)
  })

  test('matches inexact colors with deltaE', function() {
    var names = namer('FF0001', { distance: 'deltaE' })
    assert.equal(names.basic[0].hex, '#FF0000')
    assert.equal(names.basic[0].name, 'red')
    assert.equal(Math.floor(names.basic[0].distance*100), 13)
  })

  test('matches inexact colors', function() {
    var names = namer('FF0001')
    assert.equal(names.basic[0].hex, '#FF0000')
    assert.equal(names.basic[0].name, 'red')
    assert.equal(Math.floor(names.basic[0].distance*100), 25)
{'fraction_non_alphanumeric': 0.17633191890617633, 'fraction_numerical': 0.036775106082036775, 'mean_word_length': 4.100961538461538, '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': '5344398', 'n_tokens_mistral': 765, 'n_tokens_neox': 705, 'n_words': 134}