<commit_before>import * as t10 from './index'
const { expect } = require('chai')

describe('t10', function () {
  describe('setResource', function () {
    it('sets the resource', function () {
      var resource = { abc: 'abc string' }

      t10.setResource(resource)

      expect(t10.getResource()).to.equal(resource)
    })

    it('resets entire resource', function () {
      var resource1 = { abc: 'abc string' }
      var resource2 = { def: 'def string' }

      t10.setResource(resource1)
      t10.setResource(resource2)

      expect(t10.getResource()).to.equal(resource2)
    })
  })

  describe('t', function () {
    it('can translate the existing keys', function () {
      var resource = { abc: 'abc string' }

      t10.setResource(resource)

      expect(t10.t('abc')).to.equal('abc string')
    })

    it('returns the key itself if the corresponding resource doesn\'t exist', function () {
      var resource = { abc: 'abc string' }

      t10.setResource(resource)

      expect(t10.t('nonexistent.key')).to.equal('nonexistent.key')
    })
  })

  describe('scan', function () {
    it('replaces t tag', function () {

    })

    it('replaces .t-text class', function () {

    })

    it('replaces .t-attr class', function () {

    })
  })

  describe('setAvailableLanguages', function () {
    it('sets available languages', function () {
      var availables = ['en', 'fr', 'ja']

      t10.setAvailableLanguages(availables)

      expect(t10.getAvailableLanguages()).to.equal(availables)
    })
  })

  describe('getBestLanguage', function () {
    it('gets the best fit language among the available ones', function () {
      var availables = ['en', 'en-Latn-US', 'en-Latn-UK', 'fr', 'ja', 'ja']

      t10.setAvailableLanguages(availables)

      expect(t10.getBestLanguage('en')).to.equal('en')
      expect(t10.getBestLanguage('en-Latn-UK')).to.equal('en-Latn-UK')
      expect(t10.getBestLanguage('en-Latn-AU')).to.equal('en')
      expect(t10.getBestLanguage('fr')).to.equal('fr')
      expect(t10.getBestLanguage('ja')).to.equal('ja')
      expect(t10.getBestLanguage('ja-Jpan-JP')).to.equal('ja')
      expect(t10.getBestLanguage('de')).to.equal('en') // default language
    })
  })
})
<commit_msg>refactor(test): use arrow where possible<commit_after>import * as t10 from './index'
const { expect } = require('chai')

describe('t10', () => {
  describe('setResource', () => {
    it('sets the resource', () => {
      var resource = { abc: 'abc string' }

      t10.setResource(resource)

      expect(t10.getResource()).to.equal(resource)
    })

    it('resets entire resource', () => {
      var resource1 = { abc: 'abc string' }
      var resource2 = { def: 'def string' }

      t10.setResource(resource1)
      t10.setResource(resource2)

      expect(t10.getResource()).to.equal(resource2)
    })
  })

  describe('t', () => {
    it('can translate the existing keys', () => {
      var resource = { abc: 'abc string' }

      t10.setResource(resource)

      expect(t10.t('abc')).to.equal('abc string')
    })

    it('returns the key itself if the corresponding resource doesn\'t exist', () => {
      var resource = { abc: 'abc string' }

      t10.setResource(resource)

      expect(t10.t('nonexistent.key')).to.equal('nonexistent.key')
    })
  })

  describe('scan', () => {
    it('replaces t tag', () => {

    })

    it('replaces .t-text class', () => {

    })

    it('replaces .t-attr class', () => {

    })
  })

  describe('setAvailableLanguages', () => {
    it('sets available languages', () => {
      var availables = ['en', 'fr', 'ja']

      t10.setAvailableLanguages(availables)

      expect(t10.getAvailableLanguages()).to.equal(availables)
    })
  })

  describe('getBestLanguage', () => {
    it('gets the best fit language among the available ones', () => {
      var availables = ['en', 'en-Latn-US', 'en-Latn-UK', 'fr', 'ja', 'ja']

      t10.setAvailableLanguages(availables)

      expect(t10.getBestLanguage('en')).to.equal('en')
      expect(t10.getBestLanguage('en-Latn-UK')).to.equal('en-Latn-UK')
      expect(t10.getBestLanguage('en-Latn-AU')).to.equal('en')
      expect(t10.getBestLanguage('fr')).to.equal('fr')
      expect(t10.getBestLanguage('ja')).to.equal('ja')
      expect(t10.getBestLanguage('ja-Jpan-JP')).to.equal('ja')
      expect(t10.getBestLanguage('de')).to.equal('en') // default language
    })
  })
})

{'fraction_non_alphanumeric': 0.18810982527796688, 'fraction_numerical': 0.021329702745631948, 'mean_word_length': 3.092850510677809, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 18, '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': '5332798', 'n_tokens_mistral': 1527, 'n_tokens_neox': 1450, 'n_words': 251}