Execute prefs.js in a test

prefs.js had never run. It lives in its own process rather than in the
compositor, so enabling the extension in a nested shell does not reach it,
and every other check in this repo was blind to it -- it would first have
executed when someone opened the preferences and found it broken.

It builds under real Adw, and the hook-status line correctly reports all
nine registered events. The shell's ExtensionPreferences base class and its
gettext are stubbed rather than loaded: both resolve an extension by
walking the caller's URL up to a registered UUID, which needs the whole
extension manager for no gain here. The stub keeps the test on this
extension's own code.

The switch count is asserted against the schema's key count, so a setting
added without a row to change it fails the test.
This commit is contained in:
av
2026-08-09 19:32:32 +03:00
parent 5398f32826
commit 97783d43b8
2 changed files with 92 additions and 0 deletions
+5
View File
@@ -209,9 +209,14 @@ gnome-extensions enable claude-code-status@git.vakhrushev.me
```sh
gjs -m tests/test-sessions.js # чтение состояния, порядок, живость, слежение
gjs -m tests/test-abbrev.js # метки чипов: сжатие, коллизии, липкость
gjs -m tests/test-prefs.js # окно настроек строится и находит хуки
tests/test-hook.sh # события -> состояния, блокировка, снос файлов
```
`prefs.js` живёт в отдельном процессе, а не в композиторе, поэтому проверка во
вложенном шелле до него не достаёт — без этого теста он единственный файл,
который впервые исполняется у пользователя.
`lib/sessions.js` намеренно ничего не импортирует из `resource:///org/gnome/shell`,
а `lib/abbrev.js` — вообще ничего. Именно это позволяет гонять их вне
композитора — в `gjs`, а `abbrev` и в `node`.