Skip to content

Commit

Permalink
More explicit setting of global DOM function
Browse files Browse the repository at this point in the history
Our component fails due to this method being undefined, so we mock it
out for these tests. We do not need to reset the mock as it is assigned
fresh on every test.
  • Loading branch information
rylnd committed Jul 29, 2020
1 parent 4191176 commit f0f089b
Showing 1 changed file with 1 addition and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,10 @@ import { AutoDownload } from './auto_download';

describe('AutoDownload', () => {
beforeEach(() => {
// our DOM environment lacks this function that our component needs
window.URL.revokeObjectURL = jest.fn();
});

afterEach(() => {
(window.URL.revokeObjectURL as jest.Mock).mockReset();
});

it('calls onDownload once if a blob is provided', () => {
const onDownload = jest.fn();
mount(<AutoDownload blob={new Blob([''])} onDownload={onDownload} />);
Expand Down

0 comments on commit f0f089b

Please sign in to comment.