I am trying to test an input tag but I want to test the content of the uploaded file. here is the code -
<input
data-testid="file-input"
type="file"
accept=".csv, .tsv"
onChange={(event) => {
if (event.target.files !== null) {
setCsvFile(event.target.files[0]);
let reader = new FileReader();
var content: string | ArrayBuffer | null | undefined;
reader.onload = function () {
content = reader.result;
console.log(reader.result);
};
reader.onerror = function () {
console.log(reader.error);
};
reader.readAsText(event.target.files[0]);
}
}}
/>;
How can I unit test what is being read by FileReader on file upload?