test: add test reliability plan and device test coverage

- Add TEST_RELIABILITY_PLAN.md documenting test strategy
- Add devices_test.go with device handler tests
- Add device_auth_test.go with device authentication middleware tests
This commit is contained in:
2026-02-13 16:37:54 -05:00
parent e9cd445ff3
commit 289284522b
4 changed files with 3820 additions and 2 deletions
+4 -2
View File
@@ -204,12 +204,14 @@ func setupDeviceTest(t *testing.T) *TestDeviceSetup {
func createTestUserOnce(t *testing.T, db *database.Queries) UserTestData {
ctx := context.Background()
// Clean up any existing test user first
// Return error if user already exists
existingUser, err := db.GetUserByEmail(ctx, "testuser@example.com")
if err == nil {
db.DeleteUser(ctx, existingUser.ID)
return fmt.Errorf("user already exists: %s", existingUser.Email)
}
return UserTestData{}
// Create user with known credentials
passwordHash := "$2a$10$JjAtK7PPa1WexQC3AUGe8OXLeuseZ/haN1Mz7emMo6CfOvMiTVXWq"
user, err := db.CreateUser(ctx, database.CreateUserParams{