i have created a simple react component which contains an input field:
import SlInput from "@shoelace-style/dist/react/input/index.js";
const Select = () => {
return <SlInput data-testId="input" value="hello"></SlInput>
};
export default Select;
i am trying to test the component using vitest - here is my test case:
test("Test", () => {
render(); const elem = screen.getByTestId("input");
//expect(elem).toBeTruthy();
expect((elem as any).value).toEqual("hello");
});
the case which tests if the component exists is passing fine but when i try to test to component's value, i get the error:
AssertionError: expected '' to deeply equal 'hello'
- Expected
+ Received
- hello
can you please advise.