mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-03-20 12:11:28 -07:00
feat(stats): add launcher stats command and build integration
- Launcher stats subcommand with cleanup mode - Stats frontend build integrated into Makefile - CI workflow updated for stats package - Config example updated with stats section - mpv plugin menu entry for stats toggle
This commit is contained in:
@@ -335,6 +335,55 @@ test('dictionary command forwards --dictionary and --dictionary-target to app co
|
||||
});
|
||||
});
|
||||
|
||||
test('stats command launches attached app flow and waits for response file', { timeout: 15000 }, () => {
|
||||
withTempDir((root) => {
|
||||
const homeDir = path.join(root, 'home');
|
||||
const xdgConfigHome = path.join(root, 'xdg');
|
||||
const appPath = path.join(root, 'fake-subminer.sh');
|
||||
const capturePath = path.join(root, 'captured-args.txt');
|
||||
fs.writeFileSync(
|
||||
appPath,
|
||||
`#!/bin/sh
|
||||
set -eu
|
||||
response_path=""
|
||||
prev=""
|
||||
for arg in "$@"; do
|
||||
if [ "$prev" = "--stats-response-path" ]; then
|
||||
response_path="$arg"
|
||||
prev=""
|
||||
continue
|
||||
fi
|
||||
case "$arg" in
|
||||
--stats-response-path=*)
|
||||
response_path="\${arg#--stats-response-path=}"
|
||||
;;
|
||||
--stats-response-path)
|
||||
prev="--stats-response-path"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
if [ -n "$SUBMINER_TEST_STATS_CAPTURE" ]; then
|
||||
printf '%s\\n' "$@" > "$SUBMINER_TEST_STATS_CAPTURE"
|
||||
fi
|
||||
mkdir -p "$(dirname "$response_path")"
|
||||
printf '%s' '{"ok":true,"url":"http://127.0.0.1:5175"}' > "$response_path"
|
||||
exit 0
|
||||
`,
|
||||
);
|
||||
fs.chmodSync(appPath, 0o755);
|
||||
|
||||
const env = {
|
||||
...makeTestEnv(homeDir, xdgConfigHome),
|
||||
SUBMINER_APPIMAGE_PATH: appPath,
|
||||
SUBMINER_TEST_STATS_CAPTURE: capturePath,
|
||||
};
|
||||
const result = runLauncher(['stats', '--log-level', 'debug'], env);
|
||||
|
||||
assert.equal(result.status, 0, `stdout:\n${result.stdout}\nstderr:\n${result.stderr}`);
|
||||
assert.match(fs.readFileSync(capturePath, 'utf8'), /^--stats\n--stats-response-path\n.+\n--log-level\ndebug\n$/);
|
||||
});
|
||||
});
|
||||
|
||||
test('jellyfin discovery routes to app --background and remote announce with log-level forwarding', () => {
|
||||
withTempDir((root) => {
|
||||
const homeDir = path.join(root, 'home');
|
||||
|
||||
Reference in New Issue
Block a user