0
17/06/2024 6:27 am
Topic starter
render.onload test cases coverage on file change event
This topic was modified 7 months ago 2 times by kishan.pitroda
1 Answer
0
17/06/2024 6:30 am
Topic starter
let mockFileReader = { onload: jest.fn(), readAsText: jest.fn().mockImplementation(function (this: FileReader, file: Blob) { if (this.onload) { const event = { target: { result: 'Full Name,Email Address,Full phone number,Title,Organization Name\nJohn Doe,john@example.com,+123456789,Manager,Example Inc.', }, } as ProgressEvent<FileReader>; this.onload(event); } }), }; global.FileReader = jest.fn().mockImplementation(() => mockFileReader) as any;
This post was modified 6 months ago by Lps75