22 lines
741 B
TypeScript
22 lines
741 B
TypeScript
|
|
import { describe, test, expect, vi, afterEach } from 'vitest';
|
||
|
|
import { uploadToWhp } from './shared';
|
||
|
|
import { uploadAsset } from '../../../utils/assets';
|
||
|
|
|
||
|
|
describe('shared.uploadToWhp', () => {
|
||
|
|
afterEach(() => {
|
||
|
|
vi.unstubAllGlobals();
|
||
|
|
delete (window as any).WHP_CONFIG;
|
||
|
|
});
|
||
|
|
|
||
|
|
test('is a thin re-export of uploadAsset (same function reference)', () => {
|
||
|
|
expect(uploadToWhp).toBe(uploadAsset);
|
||
|
|
});
|
||
|
|
|
||
|
|
test('still works standalone (no WHP_CONFIG -> blob: URL) for existing callers', async () => {
|
||
|
|
(URL as any).createObjectURL = vi.fn(() => 'blob:mock-url');
|
||
|
|
const file = new File(['x'], 'photo.png', { type: 'image/png' });
|
||
|
|
const url = await uploadToWhp(file);
|
||
|
|
expect(url).toBe('blob:mock-url');
|
||
|
|
});
|
||
|
|
});
|