<commit_before>'use strict';

const assert = require('assert');
const Images = require('../src/images');

describe('Images', () => {
  describe('#getRandom()', () => {
    let records = {
      '😱': [ 'http://example.com' ]
    };

    it('should return an image', () => {
      let images = new Images(records);
      let image = images.getRandom();

      assert.equal(image.getKey(), '😱');
      assert.equal(image.toString(), 'http://example.com');
    });
  });

  describe('#getFromText', () => {
    describe('emoji present', () => {
      describe('record found and complete', () => {
        describe('sequence length', () => {
          let records = {
            // shorter sequences should be skipped:<commit_msg>add failing test case<commit_after>'use strict';

const assert = require('assert');
const Images = require('../src/images');

describe('Images', () => {
  describe('#getRandom()', () => {
    describe('not blacklisted', () => {
      let records = {
        '😱': [ 'http://example.com' ]
      };

      it('should return an image', () => {
        let images = new Images(records);
        let image = images.getRandom();

        assert.equal(image.getKey(), '😱');
        assert.equal(image.toString(), 'http://example.com');
      });
    });

    describe('blacklisted', () => {
      let records = {
        '🔫': [ 'http://example.com' ]
      };

      it('should return null', () => {
        let images = new Images(records);
        let image = images.getRandom();

        assert.equal(image, null);
      });
    });
  });

  describe('#getFromText', () => {
    describe('emoji present', () => {
      describe('record found and complete', () => {
        describe('sequence length', () => {
          let records = {
            // shorter sequences should be skipped:
{'fraction_non_alphanumeric': 0.20243362831858408, 'fraction_numerical': 0.0, 'mean_word_length': 2.4391634980988592, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 20, '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': '1723548', 'n_tokens_mistral': 528, 'n_tokens_neox': 511, 'n_words': 111}