aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub/tests
diff options
context:
space:
mode:
Diffstat (limited to 'packages/meshbay-hub/tests')
-rw-r--r--packages/meshbay-hub/tests/test_desktop_shell.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/packages/meshbay-hub/tests/test_desktop_shell.py b/packages/meshbay-hub/tests/test_desktop_shell.py
index f1dd399..45e3ed4 100644
--- a/packages/meshbay-hub/tests/test_desktop_shell.py
+++ b/packages/meshbay-hub/tests/test_desktop_shell.py
@@ -376,3 +376,35 @@ def test_package_json_does_not_define_a_second_linux_package():
assert "electron-builder" not in dist, (
"the dist script builds packages with electron-builder again; it "
"should delegate to packaging/build/build-client.sh")
+
+
+# ── System tray is cross-platform ────────────────────────────────────────────
+
+def test_tray_capability_and_ipc_handler_agree_on_which_platforms():
+ """
+ The tray (GNOME, then Windows) has exactly two platform gates: the
+ `tray` capability preload.js exposes, which is all app.js's nav button
+ is keyed on, and the `window:minimize-to-tray` IPC handler in main.js
+ that actually creates it. Both must name the same platform set, or one
+ of two broken states results: a button that renders but does nothing
+ (handler stricter than the capability), or a hidden window with no way
+ back (capability stricter than the handler, on a desktop with no tray
+ to have hidden it into). Everything else the tray uses (`ensureTray`,
+ `tray.on('click')`, the poll-refresh, `nodeService.status/stop/restart`)
+ is unconditional Electron/abstraction code with no platform check of its
+ own -- these two lines are the whole gate.
+ """
+ preload = _preload()
+ cap_line = next(
+ (line for line in preload.splitlines() if "tray:" in line
+ and "process.platform" in line), None)
+ assert cap_line, "no platform-gated `tray:` capability found in preload.js"
+
+ lines = _main().splitlines()
+ handler_start = next(
+ i for i, line in enumerate(lines) if "'window:minimize-to-tray'" in line)
+ handler_block = "\n".join(lines[handler_start:handler_start + 5])
+
+ for plat in ("'linux'", "'win32'"):
+ assert plat in cap_line, f"tray capability must name {plat}"
+ assert plat in handler_block, f"minimize-to-tray handler must name {plat}"