import * as React from 'react'
import { render } from '@testing-library/react'
import { describe, it, expect, vi } from 'vitest'
import PlayerEdit from './PlayerEdit'
const hooks = vi.hoisted(() => ({ editProps: null }))
vi.mock('react-admin', async () => {
const actual = await vi.importActual('react-admin')
return {
...actual,
Edit: (props) => {
hooks.editProps = props
return null
},
}
})
describe('PlayerEdit', () => {
it('saves pessimistically', () => {
render(<PlayerEdit resource="player" id="p1" />)
expect(hooks.editProps.mutationMode).toBe('pessimistic')
})
})