test: expand bridge unit coverage for payloads and errors

This commit is contained in:
2026-05-10 00:29:48 +02:00
parent da0b396bf8
commit 2d444e9a8b
3 changed files with 153 additions and 28 deletions
+4 -1
View File
@@ -9,6 +9,7 @@ Provide a TypeScript wrapper around KeePass `.kdbx` databases using a Python bri
- TypeScript spawns a Python process per request; there is no persistent worker yet.
- JSON is exchanged over stdin/stdout.
- Bridge errors, empty output, invalid JSON, missing files, and backend exceptions are surfaced as TypeScript errors.
- Coverage now includes `keyFile` payload propagation and core API smoke checks.
## Public API
- `openKeePassDatabase(path, options)`
@@ -19,6 +20,7 @@ Provide a TypeScript wrapper around KeePass `.kdbx` databases using a Python bri
- `KeePassDatabase.createGroup(group)`
- `KeePassDatabase.save()`
- `KeePassDatabase.close()` is a no-op.
## Types
- Entries expose: `title`, `username`, `password`, `url`, `notes`, optional `groupPath`, optional `otp`.
- Groups expose: `name`, `path`.
@@ -34,9 +36,10 @@ Provide a TypeScript wrapper around KeePass `.kdbx` databases using a Python bri
## Fixtures and tests
- Bundled fixtures: `tests/fixtures/data.kdbx` and `tests/fixtures/empty.kdbx`.
- Companion JSON fixture: `tests/fixtures/data.kdbx.json` stores the password and expected content.
- Unit tests in `tests/unit/` mock the child process and validate bridge parsing/error handling.
- Unit tests in `tests/unit/` mock the child process and validate bridge parsing, error handling, command forwarding, and payload shaping.
- Integration tests in `tests/integration/` use `data.kdbx` to verify entries, groups, partial search, OTP/TOTP output, and basic write persistence on a temporary copy when `pykeepass` is installed.
- The integration test runner checks for `pykeepass` and skips cleanly when it is unavailable.
- Memory tracking files: `.memory/state.md` and `.memory/todo.md`.
## Main scripts
- `bun run test` / `bun test`