Files
site-builder/craft/src/panels/right/styles/shared.uploadToWhp.test.ts
T

22 lines
741 B
TypeScript
Raw Normal View History

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');
});
});