<commit_before>import waitForImage from '../waitForImage';

test('Returns when image gets naturalWidth', (done) => {
  const mockImage = {
    src: 'test.jpg',
    addEventListener: () => {},
  };

  waitForImage(mockImage, () => {
    done();
  });

  setTimeout(() => {
    mockImage.naturalWidth = true;
  }, 100);
});

test('Error listener also returns', (done) => {
  let errorListener;
  const mockImage = {
    src: 'test.jpg',
    addEventListener: (name, func) => {
      errorListener = func;
    },
  };

  waitForImage(mockImage, () => {
    done();
  });

  setTimeout(() => {
    errorListener();
  }, 100);<commit_msg>Fix waitforimage test<commit_after>import waitForImage from '../waitForImage';

test('Returns when image gets naturalWidth', (done) => {
  const mockImage = {
    src: 'test.jpg',
    addEventListener: () => {},
  };

  waitForImage(mockImage).then(done);

  setTimeout(() => {
    mockImage.naturalWidth = true;
  }, 100);
});

test('Error listener also returns', (done) => {
  let errorListener;
  const mockImage = {
    src: 'test.jpg',
    addEventListener: (name, func) => {
      errorListener = func;
    },
  };

  waitForImage(mockImage).then(done);

  setTimeout(() => {
    errorListener();
  }, 100);
{'fraction_non_alphanumeric': 0.18138041733547353, 'fraction_numerical': 0.009630818619582664, 'mean_word_length': 3.2852233676975944, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '2356757', 'n_tokens_mistral': 411, 'n_tokens_neox': 390, 'n_words': 83}