fix(tests): protect dev admin from test cleanup, use isolated test names

Tests were deleting the development admin user, causing ON DELETE SET NULL
to cascade and set created_by_admin_id to NULL on all libraries.

- test_helpers: skip deletion of testuser@tests.bookhoard.internal
- sync_integration_test: use test-sync% prefix for isolated test data
This commit is contained in:
2026-05-16 19:31:46 -04:00
parent 5dca78789d
commit 73fc609d7b
2 changed files with 7 additions and 3 deletions
+1 -1
View File
@@ -37,7 +37,7 @@ func setupSyncTestDB(t *testing.T) *database.Queries {
_, _ = dbPool.Exec(ctx, "DELETE FROM media_items WHERE title LIKE 'Test %'")
_, _ = dbPool.Exec(ctx, "DELETE FROM libraries WHERE name LIKE 'Test %'")
_, _ = dbPool.Exec(ctx, "DELETE FROM devices WHERE device_name LIKE 'Test %'")
_, _ = dbPool.Exec(ctx, "DELETE FROM users WHERE email LIKE 'test%'")
_, _ = dbPool.Exec(ctx, "DELETE FROM users WHERE email LIKE 'test-sync%'")
dbPool.Close()
})