mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-24 14:42:11 -03:00
fix(test): add fetch polyfill and update context menu test for new API implementation
- Add fetch polyfill to test setup for jsdom environment
- Update context menu test to match new implementation that uses fetch API
- Remove deprecated handleDownloadButton expectation
- Fix mock indices for multiple fetch calls
Resolves test failures from commit b0f0158 which refactored GlobalContextMenu
to use fetch API directly instead of calling exampleImagesManager.
This commit is contained in:
@@ -1,6 +1,22 @@
|
||||
import { afterEach, beforeEach } from 'vitest';
|
||||
import { resetDom } from './utils/domFixtures.js';
|
||||
|
||||
// Polyfill fetch for jsdom environment
|
||||
if (typeof window !== 'undefined' && !window.fetch) {
|
||||
window.fetch = async function(url, options) {
|
||||
return {
|
||||
ok: true,
|
||||
status: 200,
|
||||
json: async () => ({}),
|
||||
text: async () => '',
|
||||
blob: async () => new Blob(),
|
||||
arrayBuffer: async () => new ArrayBuffer(8),
|
||||
headers: new Headers(),
|
||||
clone: () => this
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
// Polyfill PointerEvent for jsdom environment
|
||||
if (typeof window !== 'undefined' && !window.PointerEvent) {
|
||||
class PointerEvent extends MouseEvent {
|
||||
|
||||
Reference in New Issue
Block a user