fix: improve handling of global File object in uploads tests (#1394)
This commit is contained in:
@@ -78,8 +78,6 @@ describe('missing File error message', () => {
|
|||||||
let prevNodeFile: unknown;
|
let prevNodeFile: unknown;
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
// The file shim captures the global File object when it's first imported.
|
// The file shim captures the global File object when it's first imported.
|
||||||
// Reset modules before each test so we can test the error thrown when it's undefined.
|
|
||||||
jest.resetModules();
|
|
||||||
const buffer = require('node:buffer');
|
const buffer = require('node:buffer');
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
prevGlobalFile = globalThis.File;
|
prevGlobalFile = globalThis.File;
|
||||||
@@ -93,7 +91,6 @@ describe('missing File error message', () => {
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
globalThis.File = prevGlobalFile;
|
globalThis.File = prevGlobalFile;
|
||||||
require('node:buffer').File = prevNodeFile;
|
require('node:buffer').File = prevNodeFile;
|
||||||
jest.resetModules();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('is thrown', async () => {
|
test('is thrown', async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user