BioFlow Requirements
Integration Test Specifications

Integration Test Specifications

UID: DOC-IT
IT-001
reviewedPassed 1. First-launch DB initialisation
UID: IT-001
RELATIONS (Parent):
STATEMENT:

Instantiate AppDatabase against a temporary filesystem path at which no database file exists. Trigger the initialisation pathway by performing any query that forces Drift's onCreate migration to run. Inspect the resulting state of the database on disk and of the seeded tables.

TEST_METHOD:

automated

TEST_TOOL:

flutter_test

ACCEPTANCE_CRITERIA:

The database file exists at the temporary path after the first query. PRAGMA user_version on the opened database equals the value of AppDatabase.schemaVersion declared in application code. The clinics table contains at least one row whose origin is "local", confirming that the bootstrap seed step executed.

ACTIVE:

true

REVIEWED_HASH:

d71dca889c0c0d8ce35e6f03e6a56b46c86ca82d2348bf5560d63d65f7c819b5

REVIEWED_BY:

@DougYoungberg

NOTES:

Test harness couples to the StrictDoc item via tags: ['IT-001'] on the flutter_test test entry. Test file location: test/integration/first_launch_db_initialization_integration_test.dart. Verifies the architectural integration of the local persistence subsystem (ARCH-001); contributes evidence to SRS-001 / SYS-001 indirectly via the typed-link graph.

IT-002
unreviewedPassed 2. Database file is encrypted at rest
UID: IT-002
RELATIONS (Parent):
STATEMENT:

Initialise an AppDatabase against a temporary filesystem path through the production openEncryptedConnection pathway with a known test key. Write a canonical row through the typed clinic API and close the database. Attempt to open the resulting file with the plain sqlite3 driver (no credential supplied) and read any user table. Attempt to open the same file through the production pathway with an incorrect key and read any user table. Then re-open the file through the production pathway with the correct key and read the canonical row.

TEST_METHOD:

automated

TEST_TOOL:

flutter_test

ACCEPTANCE_CRITERIA:

The unkeyed open and the wrong-key open both return a SQLCipher error (typically "file is not a database" or "file is encrypted"), demonstrating the file cannot be read with any arbitrary key. The correct-key open succeeds and the canonical row written before close is readable.

ACTIVE:

true

NOTES:

Test name carries the UID prefix (IT-002) so the Flutter/JUnit join channel resolves. Test file location: test/integration/database_encryption_at_rest_integration_test.dart (distinct from test/integration/encryption_test.dart, which covers EncryptionService primitives only).