Expect Tailscale on the right in the bar defaults test

99293aa gave the Tailscale widget a right defaultSection, but the test
still asserted it landed in center after the weather widget, and that
dropbox was the first widget after the tray.

Anchor both assertions on the tray so they track the placement contract
in omarchy-bar rather than hardcoded indexes.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
David Heinemeier Hansson
2026-08-09 04:22:01 -07:00
co-authored by Claude Opus 5
parent e4d85bd037
commit 8be0ca9d43
+18 -11
View File
@@ -371,9 +371,11 @@ pass "bar defaults restores the stock bar"
HOME="$TMPDIR/home" OMARCHY_PATH="$ROOT" PATH="$mock_path" OMARCHY_TEST_DROPBOX=1 OMARCHY_TEST_TAILSCALE=1 omarchy-bar defaults
jq -e '
def ids: map(.id // .);
(.bar.layout.center | ids) as $center |
(.bar.layout.right | ids | index("omarchy.dropbox") == 1) and
($center | index("omarchy.tailscale") == (($center | index("omarchy.weather")) + 1))
(.bar.layout.right | ids) as $right |
($right | index("omarchy.tray")) as $tray |
($right | index("omarchy.tailscale") == $tray + 1) and
($right | index("omarchy.dropbox") == $tray + 2) and
(.bar.layout.center | ids | index("omarchy.tailscale") == null)
' "$TMPDIR/home/.config/omarchy/shell.json" >/dev/null
pass "bar defaults places plugins for running optional services"
@@ -382,26 +384,31 @@ HOME="$TMPDIR/home" OMARCHY_PATH="$ROOT" PATH="$mock_path" \
omarchy-bar defaults
jq -e '
def ids: map(.id // .);
(.bar.layout.center | ids) as $center |
(.bar.layout.right | ids | index("omarchy.dropbox") == 1) and
($center | index("omarchy.tailscale") == (($center | index("omarchy.weather")) + 1))
(.bar.layout.right | ids) as $right |
($right | index("omarchy.tray")) as $tray |
($right | index("omarchy.tailscale") == $tray + 1) and
($right | index("omarchy.dropbox") == $tray + 2) and
(.bar.layout.center | ids | index("omarchy.tailscale") == null)
' "$TMPDIR/home/.config/omarchy/shell.json" >/dev/null
pass "bar defaults places service widgets without a running shell"
HOME="$TMPDIR/home" OMARCHY_PATH="$ROOT" PATH="$mock_path" OMARCHY_TEST_DROPBOX=0 OMARCHY_TEST_TAILSCALE=0 omarchy-refresh-shell
jq -e '
def ids: map(.id // .);
(.bar.layout.right | ids | index("omarchy.dropbox") == null) and
(.bar.layout.center | ids | index("omarchy.tailscale") == null)
([.bar.layout.left, .bar.layout.center, .bar.layout.right] | map(ids) | add) as $all |
($all | index("omarchy.dropbox") == null) and
($all | index("omarchy.tailscale") == null)
' "$TMPDIR/home/.config/omarchy/shell.json" >/dev/null
pass "shell refresh keeps optional service widgets absent when services are unavailable"
HOME="$TMPDIR/home" OMARCHY_PATH="$ROOT" PATH="$mock_path" OMARCHY_TEST_DROPBOX=1 OMARCHY_TEST_TAILSCALE=1 omarchy-refresh-shell
jq -e '
def ids: map(.id // .);
(.bar.layout.center | ids) as $center |
(.bar.layout.right | ids | index("omarchy.dropbox") == 1) and
($center | index("omarchy.tailscale") == (($center | index("omarchy.weather")) + 1))
(.bar.layout.right | ids) as $right |
($right | index("omarchy.tray")) as $tray |
($right | index("omarchy.tailscale") == $tray + 1) and
($right | index("omarchy.dropbox") == $tray + 2) and
(.bar.layout.center | ids | index("omarchy.tailscale") == null)
' "$TMPDIR/home/.config/omarchy/shell.json" >/dev/null
[[ -f $TMPDIR/home/.local/state/omarchy/restart-shell-called ]] || fail "shell refresh restarts shell"
pass "shell refresh places optional service widgets when services are available"