fix: resolve merge test regressions — openSession connect POST and cycleViewMode mock

This commit is contained in:
Brian Krabach
2026-03-31 09:21:05 -07:00
parent 5a67a3eb3e
commit 3707283baf
2 changed files with 6 additions and 8 deletions
-2
View File
@@ -1254,14 +1254,12 @@ async function openSession(name, opts = {}) {
// Always spawn ttyd for this session — ensures correct session after service restart or page restore
var _sourceUrl = opts.sourceUrl || '';
try {
if (!opts.skipConnect) {
if (_sourceUrl) {
var remoteConnectUrl = _sourceUrl.replace(/\/+$/, '') + '/api/sessions/' + encodeURIComponent(name) + '/connect';
await fetch(remoteConnectUrl, { method: 'POST', credentials: 'include' });
} else {
await api('POST', '/api/sessions/' + encodeURIComponent(name) + '/connect');
}
}
} catch (err) {
showToast(err.message || 'Connection failed');
return closeSession();
+1 -1
View File
@@ -3317,7 +3317,7 @@ test('openSession always POSTs to connect even when skipConnect option is passed
const origQS = globalThis.document.querySelector;
const origSetTimeout = globalThis.setTimeout;
globalThis.fetch = async (url, opts) => { fetchCalls.push({ url, opts }); return { ok: true }; };
globalThis.document.getElementById = () => ({ textContent: '', style: {}, classList: { remove: () => {}, add: () => {} } });
globalThis.document.getElementById = () => ({ textContent: '', style: { removeProperty: () => {} }, classList: { remove: () => {}, add: () => {} } });
globalThis.document.querySelector = () => null;
globalThis.setTimeout = () => {};
globalThis.window._openTerminal = () => {};