<commit_before>import React from 'react';
import GreetingMaster from '../src/GreetingMaster';
import GreetingDetail from '../src/GreetingDetail';
import GreetingController from '../src/GreetingController';
import backend from '../src/backend';
import renderer from 'react-test-renderer';
import {shallow, mount} from 'enzyme';

jest.mock('../src/backend', () => ({
    loadFromServer: jest.fn((success, failure) => success([
        {id: 1, name: 'Klaus', greeting: 'Moin moin'},
        {id: 2, name: 'Susi', greeting: 'Hello!'}
    ]))
}));

test('it should render greetings received from backend', () => {
    const tree = renderer.create(
        <GreetingController/>
    ).toJSON();
    expect(tree).toMatchSnapshot();
});

test('it should open detail view on button click', () => {
    const component = mount(<GreetingController  />);

    // on initial render the list with greetings (GreetingMaster)
    // is visible but no GreetingDetail<commit_msg>Clean up<commit_after>import React from 'react';
import GreetingDetail from '../src/GreetingDetail';
import GreetingController from '../src/GreetingController';
import renderer from 'react-test-renderer';
import {mount} from 'enzyme';

// Mock the backend module avoid "real" server calls
jest.mock('../src/backend', () => ({
    loadFromServer: jest.fn((success, failure) => success([
        {id: 1, name: 'Klaus', greeting: 'Moin moin'},
        {id: 2, name: 'Susi', greeting: 'Hello!'}
    ]))
}));

test('it should render greetings received from backend', () => {
    // render the component we want to test
    const tree = renderer.create(
        <GreetingController/>
    ).toJSON();

    // make sure the json matches the last stored snapshot
    // (saved on the filesystem in __snapshots__)
    expect(tree).toMatchSnapshot();
});

test('it should open detail view on button click', () => {
    // mount the component into a real dom (implemented by JSDom)
    const component = mount(<GreetingController  />);

    // on initial render the list with greetings (GreetingMaster)
    // is visible but no GreetingDetail
{'fraction_non_alphanumeric': 0.14586322333811574, 'fraction_numerical': 0.001912960306073649, 'mean_word_length': 3.680089485458613, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, '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': '2138253', 'n_tokens_mistral': 608, 'n_tokens_neox': 599, 'n_words': 199}