<commit_before>import React from 'react'
import sinon from 'sinon'
import { expect } from 'chai'
import { mount, shallow, render } from 'enzyme'
import { MemoryRouter } from 'react-router-dom'

import DeleteForm from '../../../../src/components/ConfigForm/General/DeleteForm.js'

describe('<DeleteForm />', () => {

    it('renders config_type', () => {
        const form = shallow(<DeleteForm
            config_name={'testname'}
            config_type={'testconfig'}
            existing_names={[]} />)
        expect(form.html()).to.contain('Would you like to delete the <b>testconfig</b> with name <b>testname</b>?')
    })

    it('refuses if the configuration is in use', () => {
        const form = shallow(<MemoryRouter>
                <DeleteForm
                    config_name={'testname'}
                    config_type={'testconfig'}
                    existing_names={[]}
                    in_use_by={[
                        {
                            name: 'Test',
                            link: 'test_link',
                            type: 'test_type'
                        }
                    ]} />
            </MemoryRouter>)
        expect(form.html()).to.contain('It is not possible to delete <b>testconfig</b>')
    })

    it('links to the configuration dependency', () => {
        const form = render(<MemoryRouter>
                <DeleteForm
                    config_name={'testname'}
                    config_type={'testconfig'}
                    existing_names={[]}
                    in_use_by={[
                        {
                            name: 'Test',
                            link: 'test_link/',
                            type: 'test_type'
                        }
                    ]} />
            </MemoryRouter>)
        const link = form.find('a[href="test_link/Test"]')
        expect(link.length).to.equal(1)
    })<commit_msg>Debug failing npm test<commit_after>import React from 'react'
import sinon from 'sinon'
import { expect } from 'chai'
import { mount, shallow } from 'enzyme'
import { MemoryRouter } from 'react-router-dom'

import DeleteForm from '../../../../src/components/ConfigForm/General/DeleteForm.js'

describe('<DeleteForm />', () => {

    it('renders config_type', () => {
        const form = shallow(<DeleteForm
            config_name={'testname'}
            config_type={'testconfig'}
            existing_names={[]} />)
        expect(form.html()).to.contain('Would you like to delete the <b>testconfig</b> with name <b>testname</b>?')
    })

    it('refuses if the configuration is in use', () => {
        const form = shallow(<MemoryRouter>
                <DeleteForm
                    config_name={'testname'}
                    config_type={'testconfig'}
                    existing_names={[]}
                    in_use_by={[
                        {
                            name: 'Test',
                            link: 'test_link',
                            type: 'test_type'
                        }
                    ]} />
            </MemoryRouter>)
        expect(form.html()).to.contain('It is not possible to delete <b>testconfig</b>')
    })

    it('links to the configuration dependency', () => {
        const form = mount(<MemoryRouter>
                <DeleteForm
                    config_name={'testname'}
                    config_type={'testconfig'}
                    existing_names={[]}
                    in_use_by={[
                        {
                            name: 'Test',
                            link: 'test_link/',
                            type: 'test_type'
                        }
                    ]} />
            </MemoryRouter>)
        const link = form.find('a[href="test_link/Test"]')
        console.log(form.debug())
        expect(link.length).to.equal(1)
    })
{'fraction_non_alphanumeric': 0.13269529229177443, 'fraction_numerical': 0.0005173305742369374, 'mean_word_length': 1.3579268292682927, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 39, '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': '4741432', 'n_tokens_mistral': 1005, 'n_tokens_neox': 967, 'n_words': 199}