<commit_before>/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

// @flow

import React from 'react';
import { render, fireEvent } from 'react-testing-library';
import DragAndDrop from '../../components/app/DragAndDrop';

describe('app/DragAndDrop', () => {
  it('matches the snapshot', () => {
    const retrieveProfileFromFile = jest.fn();
    const { container } = render(
      <DragAndDrop retrieveProfileFromFile={retrieveProfileFromFile}>
        Target area here
      </DragAndDrop>
    );
    const [targetArea, message] = container.children;
    expect(targetArea).toMatchSnapshot();
    expect(message).toMatchSnapshot();
  });

  it('responds to dragging', () => {
    // It would be better if we could check that when dropping
    // something on the area we'd get a call to
    // `retrieveProfileFromFile`, but jsdom is not supporting
    // `dataTransfer`. See
    // https://github.com/testing-library/react-testing-library/issues/339
    // for more info.<commit_msg>Add reference to issue about improving drag and drop test<commit_after>/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

// @flow

import React from 'react';
import { render, fireEvent } from 'react-testing-library';
import DragAndDrop from '../../components/app/DragAndDrop';

describe('app/DragAndDrop', () => {
  it('matches the snapshot', () => {
    const retrieveProfileFromFile = jest.fn();
    const { container } = render(
      <DragAndDrop retrieveProfileFromFile={retrieveProfileFromFile}>
        Target area here
      </DragAndDrop>
    );
    const [targetArea, message] = container.children;
    expect(targetArea).toMatchSnapshot();
    expect(message).toMatchSnapshot();
  });

  it('responds to dragging', () => {
    // It would be better if we could check that when dropping
    // something on the area we'd get a call to
    // `retrieveProfileFromFile`, but jsdom is not supporting
    // `dataTransfer`. We should improve this test when that support
    // is added:
    // https://github.com/firefox-devtools/profiler/issues/2366
{'fraction_non_alphanumeric': 0.12404418011894647, 'fraction_numerical': 0.006372132540356839, 'mean_word_length': 3.289617486338798, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, 'https://': 2, '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': '3419285', 'n_tokens_mistral': 669, 'n_tokens_neox': 651, 'n_words': 226}