[iOS & Android] iOS 1.2.4 & Android 1.7.3

This commit is contained in:
2025-10-06 11:54:36 -06:00
parent acf487db93
commit c10fa48bf5
10 changed files with 245 additions and 54 deletions

View File

@@ -454,4 +454,61 @@ class SyncMergeLogicTest {
dateString1 > dateString2
}
}
@Test
fun `test active sessions excluded from sync`() {
// Test scenario: Active sessions should not be included in sync data
// This tests the new behavior where active sessions are excluded from sync
// until they are completed
val allLocalSessions =
listOf(
BackupClimbSession(
id = "active_session_1",
gymId = "gym1",
date = "2024-01-01",
startTime = "2024-01-01T10:00:00",
endTime = null,
duration = null,
status = SessionStatus.ACTIVE,
notes = null,
createdAt = "2024-01-01T10:00:00",
updatedAt = "2024-01-01T10:00:00"
),
BackupClimbSession(
id = "completed_session_1",
gymId = "gym1",
date = "2023-12-31",
startTime = "2023-12-31T15:00:00",
endTime = "2023-12-31T17:00:00",
duration = 7200000,
status = SessionStatus.COMPLETED,
notes = "Previous session",
createdAt = "2023-12-31T15:00:00",
updatedAt = "2023-12-31T17:00:00"
)
)
// Simulate filtering that would happen in createBackupFromRepository
val sessionsForSync = allLocalSessions.filter { it.status != SessionStatus.ACTIVE }
// Only completed sessions should be included in sync
assertEquals("Should only include completed sessions in sync", 1, sessionsForSync.size)
// Active session should be excluded
assertFalse(
"Should not contain active session in sync",
sessionsForSync.any {
it.id == "active_session_1" && it.status == SessionStatus.ACTIVE
}
)
// Completed session should be included
assertTrue(
"Should contain completed session in sync",
sessionsForSync.any {
it.id == "completed_session_1" && it.status == SessionStatus.COMPLETED
}
)
}
}