<commit_before>import React from 'react'
import { render, fireEvent, configure } from '@testing-library/react'
import MoveModal from './MoveModal'
import CozyClient, { CozyProvider } from 'cozy-client'
import useInstanceSettings from 'hooks/useInstanceSettings'
import AppLike from '../../test/AppLike'

configure({ testIdAttribute: 'data-test-id' })

jest.mock('hooks/useInstanceSettings', () => jest.fn())

describe('MoveModal', () => {
  const setup = () => {
    const client = new CozyClient()
    client.stackClient.fetchJSON = jest.fn()
    const root = render(
      <AppLike>
        <CozyProvider client={client}>
          <MoveModal />
        </CozyProvider>
      </AppLike>
    )
    return { root, client }
  }

  it('should send a delete request and hide itself on close', () => {
    useInstanceSettings.mockReturnValue({
      data: {
        moved_from: 'source.cozy.tools'
      }
    })
    const { client, root } = setup()
    expect(
      root.getByText(
        'The move of your data from source.cozy.tools has been successful.'
      )
    ).toBeTruthy()

    const closeBtn = root.getByTestId('modal-close-button-0')

    fireEvent.click(closeBtn)
    expect(client.getStackClient().fetchJSON).toHaveBeenCalledWith(
      'DELETE',
      '/settings/instance/moved_from'
    )
    expect(root.queryByRole('document').style.opacity).toBe('0')
  })
})
<commit_msg>test: Update MoveModal test after upgrade to muiv4<commit_after>import React from 'react'
import { render, fireEvent, configure } from '@testing-library/react'
import MoveModal from './MoveModal'
import CozyClient, { CozyProvider } from 'cozy-client'
import useInstanceSettings from 'hooks/useInstanceSettings'
import AppLike from '../../test/AppLike'

configure({ testIdAttribute: 'data-test-id' })

jest.mock('hooks/useInstanceSettings', () => jest.fn())

describe('MoveModal', () => {
  const setup = () => {
    const client = new CozyClient()
    client.stackClient.fetchJSON = jest.fn()
    const root = render(
      <AppLike>
        <CozyProvider client={client}>
          <MoveModal />
        </CozyProvider>
      </AppLike>
    )
    return { root, client }
  }

  it('should send a delete request and hide itself on close', () => {
    useInstanceSettings.mockReturnValue({
      data: {
        moved_from: 'source.cozy.tools'
      }
    })
    const { client, root } = setup()
    expect(
      root.getByText(
        'The move of your data from source.cozy.tools has been successful.'
      )
    ).toBeTruthy()

    const closeBtn = root.getByTestId('modal-close-button-0')

    fireEvent.click(closeBtn)
    expect(client.getStackClient().fetchJSON).toHaveBeenCalledWith(
      'DELETE',
      '/settings/instance/moved_from'
    )
    const dialogPaper = root.queryByRole('none')
    expect(dialogPaper.style.opacity).toBe('0')
  })
})

{'fraction_non_alphanumeric': 0.13689013689013688, 'fraction_numerical': 0.001755001755001755, 'mean_word_length': 3.106628242074928, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 21, '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': '1536778', 'n_tokens_mistral': 867, 'n_tokens_neox': 864, 'n_words': 194}