diff options
| author | Paul Buetow <paul@buetow.org> | 2026-06-05 22:30:04 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-06-05 22:30:04 +0300 |
| commit | d7b05fb979afaaa1ffe466f6d638257493a79bd9 (patch) | |
| tree | 71275c2c8a7229311e74f53239ee8f6c088a4938 /tests/cli.sh | |
| parent | 1ad603d46a64482f095da4b0d54c1147cf757c09 (diff) | |
Add refresh-splash CLI rejection tests
Diffstat (limited to 'tests/cli.sh')
| -rwxr-xr-x | tests/cli.sh | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/tests/cli.sh b/tests/cli.sh index 63383fa..dee41e9 100755 --- a/tests/cli.sh +++ b/tests/cli.sh @@ -2203,6 +2203,55 @@ test_refresh_splash_requires_existing_generated_assets() { test::teardown } +test_refresh_splash_requires_existing_generated_blurs() { + local config_file + local output + + test::setup + config_file="$TEST_TMPDIR/photoalbum.conf" + mkdir -p "$TEST_TMPDIR/incoming" \ + "$TEST_TMPDIR/dist" \ + "$TEST_TMPDIR/dist/photos" + test::write_album_config \ + "$config_file" "$TEST_TMPDIR/incoming" "$TEST_TMPDIR/dist" \ + 'Missing splash blurs album' 40 + + output=$( + cd "$TEST_TMPDIR" + test::capture_failure_output "$TEST_PHOTOALBUM" --refresh-splash + ) + + test::assert_contains \ + "ERROR: DIST_DIR blurs directory $TEST_TMPDIR/dist/blurs must exist" \ + "$output" + test::assert_path_absent "$TEST_TMPDIR/dist/index.html" + test::teardown +} + +test_refresh_splash_rejects_no_splash_config() { + local config_file + local output + + test::setup + config_file="$TEST_TMPDIR/photoalbum.conf" + mkdir -p "$TEST_TMPDIR/incoming" "$TEST_TMPDIR/dist" + test::write_album_config \ + "$config_file" "$TEST_TMPDIR/incoming" "$TEST_TMPDIR/dist" \ + 'No splash refresh album' 40 + printf 'SPLASH_PAGE=no\n' >> "$config_file" + + output=$( + cd "$TEST_TMPDIR" + test::capture_failure_output "$TEST_PHOTOALBUM" --refresh-splash + ) + + test::assert_contains \ + 'ERROR: SPLASH_PAGE must be yes to refresh the splash page' \ + "$output" + test::assert_path_absent "$TEST_TMPDIR/dist/index.html" + test::teardown +} + test_generate_replaces_dist_after_success() { local config_file local fake_bin @@ -3122,6 +3171,12 @@ main() { '--refresh-splash requires existing generated assets' \ test_refresh_splash_requires_existing_generated_assets test::run_case \ + '--refresh-splash requires existing generated blurs' \ + test_refresh_splash_requires_existing_generated_blurs + test::run_case \ + '--refresh-splash rejects SPLASH_PAGE=no' \ + test_refresh_splash_rejects_no_splash_config + test::run_case \ '--generate replaces final dist after success' \ test_generate_replaces_dist_after_success test::run_case \ |
