tests: add end-to-end PDF generation check

Exercises the chromium/snappdf pipeline via POST /api/v1/preview with
no entity, which falls back to PdfMock's self-contained mock PDF -
verified this needs no client/invoice test data, since a fresh account
has neither. Asserts the response starts with the %PDF magic bytes.

This was previously the biggest untested path in the module: an actual
binary runtime dependency (chromium) rather than just config, and the
kind of thing that silently breaks in a minimal NixOS closure.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-26 15:50:24 -04:00
co-authored by Claude Sonnet 5
parent fd055f0cf9
commit ccf4d01a34
2 changed files with 17 additions and 3 deletions
+6 -3
View File
@@ -48,9 +48,12 @@ This project uses `just` (see `justfile`) and Nix directly.
against each node: waits for mysql/redis/phpfpm/queue-worker/proxy to be active, checks the
`invoiceninja-data-setup` marker files (`.initial-migration`, `.db-seeded`, `.admin-created`) to confirm the
one-time setup actually completed (not just that the oneshot unit exited), curls `/` for the app shell, exercises
the `invoiceninja-manage` wrapper, and logs in via `/api/v1/login` using the test admin credentials as an
end-to-end check that migrations/seeding/account creation all worked. This is the only automated test in the
repo — there is no separate unit-test suite.
the `invoiceninja-manage` wrapper, logs in via `/api/v1/login` using the test admin credentials as an
end-to-end check that migrations/seeding/account creation all worked, checks the full language list is
available (see the `cache:forget languages` note above), and exercises PDF generation end-to-end (POSTs to
`/api/v1/preview` with no entity, which falls back to a self-contained mock PDF built via the same
chromium/snappdf pipeline real invoices use, and checks for the `%PDF` magic bytes — no client/invoice setup
needed). This is the only automated test in the repo — there is no separate unit-test suite.
## Architecture