<commit_before>import React from 'react'; // eslint-disable-line no-unused-vars
import ReactTestUtils from 'react-dom/test-utils';

import ScrapEditor from './scrap_editor';


test('scrap title', function () {
  const editor = getScrapEditor({raw_title: '*Hello*'});
  expect(editor.refs.title.value).toBe('*Hello*')
});


test('handleSubmit', function () {
  const updateScrap = jest.fn();
  const closeScrapEditor = jest.fn();
  const editor = getScrapEditor({}, { updateScrap, closeScrapEditor });

  editor.handleSubmit({ preventDefault: () => {} });

  expect(updateScrap.mock.calls.length).toBe(1)
  expect(closeScrapEditor.mock.calls.length).toBe(1)
});


test('deleteScrap', function () {
  const deleteScrap = jest.fn();
  const closeScrapEditor = jest.fn();
  const editor = getScrapEditor({}, { deleteScrap, closeScrapEditor });

  editor.deleteScrap();

  expect(deleteScrap.mock.calls.length).toBe(1)
  expect(closeScrapEditor.mock.calls.length).toBe(1)
});


test('toggleMoreActionsDropdown', function () {
  const editor = getScrapEditor();<commit_msg>Test arguments passed to updateScrap and deleteScrap<commit_after>import React from 'react'; // eslint-disable-line no-unused-vars
import ReactTestUtils from 'react-dom/test-utils';

import ScrapEditor from './scrap_editor';


test('scrap title', function () {
  const editor = getScrapEditor({raw_title: '*Hello*'});
  expect(editor.refs.title.value).toBe('*Hello*')
});


test('handleSubmit', function () {
  const scrap = { raw_title: 'test-title' };
  const updateScrap = jest.fn();
  const closeScrapEditor = jest.fn();
  const editor = getScrapEditor(scrap, { updateScrap, closeScrapEditor });

  editor.handleSubmit({ preventDefault: () => {} });

  expect(updateScrap.mock.calls.length).toBe(1)
  expect(updateScrap.mock.calls[0][0]).toEqual(scrap)
  expect(closeScrapEditor.mock.calls.length).toBe(1)
});


test('deleteScrap', function () {
  const scrap = { id: 42 };
  const deleteScrap = jest.fn();
  const closeScrapEditor = jest.fn();
  const editor = getScrapEditor(scrap, { deleteScrap, closeScrapEditor });

  editor.deleteScrap();

  expect(deleteScrap.mock.calls.length).toBe(1)
  expect(deleteScrap.mock.calls[0][0]).toEqual(scrap)
  expect(closeScrapEditor.mock.calls.length).toBe(1)
});


test('toggleMoreActionsDropdown', function () {
  const editor = getScrapEditor();
{'fraction_non_alphanumeric': 0.16228813559322033, 'fraction_numerical': 0.005932203389830509, 'mean_word_length': 5.346774193548387, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '6740780', 'n_tokens_mistral': 777, 'n_tokens_neox': 768, 'n_words': 135}