How i can simply make unit testing for the value of input type file :
<input required type="file" class="form-control blue-border" accept=".jpg, .jpeg, .png" data-testid="file" />
I tryed
descripe('ex....',()=>{
test('ex.....',()=>{
const file=screen.getByTestId('file')
expect(file.value='myfile.png').toContain(/(\.jpg|\.jpeg|\.png)$/i)
})
})
but i have error : InvalidStateError: This input element accepts a filename, which may only be programmatically set to the empty string.
try this
expect(file.value).toMatch(/(\.jpg|\.jpeg|\.png)$/i)