Fix attachment deduplication issue with Stories.

This commit is contained in:
Alex Hart
2022-06-28 16:37:36 -03:00
committed by Cody Henthorne
parent ed25be2e23
commit ba6e1b5dd5
7 changed files with 64 additions and 57 deletions

View File

@@ -180,6 +180,26 @@ class UploadDependencyGraphTest {
}
}
@Test
fun `Given a list of attachments of the same uri with different transform props, when I consumeDeferredQueue, then I expect two chains`() {
val uriAttachments = (0..1).map {
UriAttachmentBuilder.build(
1L,
contentType = MediaUtil.IMAGE_JPEG,
transformProperties = AttachmentDatabase.TransformProperties.forVideoTrim(it.toLong(), it.toLong() + 1)
)
}
val message = OutgoingMediaMessageBuilder.create(attachments = uriAttachments)
val testSubject = UploadDependencyGraph.create(listOf(message), jobManager) { getAttachmentForPreUpload(uniqueLong.getAndIncrement(), it) }
val result = testSubject.consumeDeferredQueue()
assertEquals(2, result.size)
result.forEach {
assertValidJobChain(it, 0)
}
}
private fun assertValidJobChain(chain: JobManager.Chain, expectedCopyDestinationCount: Int) {
val steps: List<List<Job>> = chain.jobListChain