I have this Vitest test:
import React from 'react';
import { expect, it, vi } from 'vitest';
import { render, screen } from '@testing-library/react';
import { StyledNativeTimePicker } from
'../timePicker/StyledNativeTimePicker.jsx';
...
it('Shows the time correctly', async () => {
const time = '12:00';
render(
<StyledNativeTimePicker
time={time}
timeChanged={() => {}}
></StyledNativeTimePicker>
);
const testInput = screen.getByRole('input', { type: 'time' });
expect(testInput).toHaveValue(time);
});
...
Now I get this error Error: Invalid Chai property: toHaveValue
. Any Idea why when Chai is not installed?
chai
assertions by default and alsoJest
compatible assertions build on top ofchai
" - neither includestoHaveValue
, perhaps you intended to use Jest-DOM. – Amateurism