mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-15 00:42:54 +01:00
library: finish the credit query review nits
Put the download-visibility comment on the constant it describes, keep the no-scan guards beside the seek assertions, and give the identical-sync test a positive control for both the artist aggregate and the album play recompute.
This commit is contained in:
@@ -871,6 +871,8 @@ class LibraryDaoTest {
|
||||
plan,
|
||||
plan.contains("USING INDEX index_song_artists_sourceId_artistId (sourceId=? AND artistId=?)"),
|
||||
)
|
||||
assertFalse(plan, plan.contains("SCAN albums"))
|
||||
assertFalse(plan, plan.contains("SCAN songs"))
|
||||
}
|
||||
|
||||
private suspend fun plan(sql: String): String =
|
||||
|
||||
@@ -1765,7 +1765,7 @@ class SyncServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun anIdenticalSyncSkipsTheArtistAggregateQuery() =
|
||||
fun anIdenticalSyncSkipsTheAggregateQueries() =
|
||||
runTest {
|
||||
val context = ApplicationProvider.getApplicationContext<Context>()
|
||||
val executions = Collections.synchronizedList(mutableListOf<SqlExecution>())
|
||||
@@ -1786,11 +1786,16 @@ class SyncServiceTest {
|
||||
)
|
||||
|
||||
SyncService(loggingDb, source).sync()
|
||||
val firstSyncExecutions = synchronized(executions) { executions.toList() }
|
||||
assertTrue(firstSyncExecutions.any { it.sql.contains("credited_albums") })
|
||||
assertTrue(firstSyncExecutions.any { it.sql.contains("UPDATE albums SET playCount") })
|
||||
|
||||
synchronized(executions) { executions.clear() }
|
||||
SyncService(loggingDb, source).sync()
|
||||
|
||||
val secondSyncExecutions = synchronized(executions) { executions.toList() }
|
||||
assertTrue(secondSyncExecutions.none { it.sql.contains("credited_albums") })
|
||||
assertTrue(secondSyncExecutions.none { it.sql.contains("UPDATE albums SET playCount") })
|
||||
} finally {
|
||||
loggingDb.close()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user