chore: cloudcmd

This commit is contained in:
coderiaser 2026-01-15 22:14:01 +02:00
parent 6e778a35ba
commit 4b84d20bb0
17 changed files with 121 additions and 132 deletions

View file

@ -14,7 +14,7 @@ export const createCloudMenu = async (fm, options, menuData) => {
async function loadMenu() {
if (CloudCmd.config('menu') === 'aleman') {
const {host, protocol} = window.location;
const {host, protocol} = globalThis.location;
const url = `${protocol}//${host}/node_modules/aleman/menu/menu.js`;
const {createMenu} = await import(/* webpackIgnore: true */url);

View file

@ -33,7 +33,7 @@ const loadAll = async () => {
const [e] = await tryToCatch(load.parallel, [js, css]);
if (e) {
const src = e.target.src.replace(window.location.href, '');
const src = e.target.src.replace(globalThis.location.href, '');
return Dialog.alert(`file ${src} could not be loaded`);
}

View file

@ -32,7 +32,7 @@ const loadAll = async () => {
const [e] = await tryToCatch(loadParallel, [js, css]);
if (e) {
const src = e.target.src.replace(window.location.href, '');
const src = e.target.src.replace(globalThis.location.href, '');
return Dialog.alert(`file ${src} could not be loaded`);
}

View file

@ -22,12 +22,9 @@ test('cloudcmd: client: view: types: detectType', async (t) => {
headers: [],
});
const originalFetch = global.fetch;
global.fetch = fetch;
globalThis.fetch = fetch;
await _detectType('/hello');
global.fetch = originalFetch;
const expected = ['/hello', {
method: 'HEAD',
}];
@ -37,17 +34,13 @@ test('cloudcmd: client: view: types: detectType', async (t) => {
});
test('cloudcmd: client: view: types: detectType: found', async (t) => {
const originalFetch = global.fetch;
global.fetch = stub().returns({
globalThis.fetch = stub().returns({
headers: [
['content-type', 'image/png'],
],
});
const result = await _detectType('/hello');
global.fetch = originalFetch;
t.equal(result, '.png');
t.end();
});