Skip to content

Commit bc99852

Browse files
committed
fix: Update test to use Blob for file creation in uploadConfiguration test
1 parent 1e94456 commit bc99852

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/config/tests/configuration-services.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { ApiService } from '@mixcore/api';
22
import { ConfigurationServices, ConfigurationUpload } from '../src/configuration-services';
3+
import { Blob } from 'node:buffer';
34

45
describe('ConfigurationServices', () => {
56
let api: ApiService;
@@ -19,7 +20,8 @@ describe('ConfigurationServices', () => {
1920
});
2021

2122
it('should call uploadConfiguration', async () => {
22-
const fakeFile = new File(['test'], 'test.txt', { type: 'text/plain' });
23+
const fakeFile = new Blob(['test'], { type: 'text/plain' }) as unknown as File;
24+
Object.defineProperty(fakeFile, 'name', { value: 'test.txt' });
2325
globalThis.fetch = jest.fn().mockResolvedValue({ ok: true, json: async () => ({ success: true }) });
2426
const result = await configServices.uploadConfiguration({ file: fakeFile, folder: 'f', title: 't', description: 'd' });
2527
expect(result).toEqual({ success: true });

0 commit comments

Comments
 (0)