Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gotson committed Aug 27, 2024
1 parent a359c0a commit 89905eb
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class SyncPointLifecycleTest(
mediaRepository.findById(bookNotEpub.id).let { media -> mediaRepository.update(media.copy(mediaType = MediaType.ZIP.type)) }

// when
val syncPoint = syncPointLifecycle.createSyncPoint(user1, listOf(library1.id))
val syncPoint = syncPointLifecycle.createSyncPoint(user1, null, listOf(library1.id))
val syncPointBooks = syncPointRepository.findBooksById(syncPoint.id, false, Pageable.unpaged())

// then
Expand Down Expand Up @@ -155,7 +155,7 @@ class SyncPointLifecycleTest(

mediaRepository.findById(book1.id).let { media -> mediaRepository.update(media.copy(status = Media.Status.READY, mediaType = MediaType.EPUB.type)) }

val syncPoint1 = syncPointLifecycle.createSyncPoint(user1, listOf(library1.id))
val syncPoint1 = syncPointLifecycle.createSyncPoint(user1, null, listOf(library1.id))

// when
val book2 = makeBook("valid", libraryId = library1.id)
Expand All @@ -164,7 +164,7 @@ class SyncPointLifecycleTest(
mediaRepository.findById(book2.id).let { media -> mediaRepository.update(media.copy(status = Media.Status.READY, mediaType = MediaType.EPUB.type)) }
mediaRepository.findById(book3.id).let { media -> mediaRepository.update(media.copy(status = Media.Status.READY, mediaType = MediaType.EPUB.type)) }

val syncPoint2 = syncPointLifecycle.createSyncPoint(user1, listOf(library1.id))
val syncPoint2 = syncPointLifecycle.createSyncPoint(user1, null, listOf(library1.id))
val booksAdded = syncPointRepository.findBooksAdded(syncPoint1.id, syncPoint2.id, false, Pageable.unpaged())
val page1 = syncPointLifecycle.takeBooksAdded(syncPoint1.id, syncPoint2.id, Pageable.ofSize(1))
val page2 = syncPointLifecycle.takeBooksAdded(syncPoint1.id, syncPoint2.id, Pageable.ofSize(1))
Expand Down Expand Up @@ -198,13 +198,13 @@ class SyncPointLifecycleTest(

bookRepository.findAll().forEach { mediaRepository.findById(it.id).let { media -> mediaRepository.update(media.copy(status = Media.Status.READY, mediaType = MediaType.EPUB.type)) } }

val syncPoint1 = syncPointLifecycle.createSyncPoint(user1, listOf(library1.id))
val syncPoint1 = syncPointLifecycle.createSyncPoint(user1, null, listOf(library1.id))

// when
bookLifecycle.softDeleteMany(listOf(bookRepository.findByIdOrNull(book2.id)!!))
bookLifecycle.deleteOne(bookRepository.findByIdOrNull(book3.id)!!)

val syncPoint2 = syncPointLifecycle.createSyncPoint(user1, listOf(library1.id))
val syncPoint2 = syncPointLifecycle.createSyncPoint(user1, null, listOf(library1.id))
val booksRemoved = syncPointRepository.findBooksRemoved(syncPoint1.id, syncPoint2.id, false, Pageable.unpaged())
val page1 = syncPointLifecycle.takeBooksRemoved(syncPoint1.id, syncPoint2.id, Pageable.ofSize(1))
val page2 = syncPointLifecycle.takeBooksRemoved(syncPoint1.id, syncPoint2.id, Pageable.ofSize(1))
Expand Down Expand Up @@ -239,15 +239,15 @@ class SyncPointLifecycleTest(

bookRepository.findAll().forEach { mediaRepository.findById(it.id).let { media -> mediaRepository.update(media.copy(status = Media.Status.READY, mediaType = MediaType.EPUB.type)) } }

val syncPoint1 = syncPointLifecycle.createSyncPoint(user1, listOf(library1.id))
val syncPoint1 = syncPointLifecycle.createSyncPoint(user1, null, listOf(library1.id))

// when
bookRepository.findByIdOrNull(book1.id)?.let { bookRepository.update(it.copy(fileLastModified = LocalDateTime.of(2020, 1, 1, 1, 1))) }
bookRepository.findByIdOrNull(book2.id)?.let { bookRepository.update(it.copy(fileHash = "hash2")) }
bookMetadataRepository.findById(book3.id).let { bookMetadataRepository.update(it.copy(title = "changed")) }
bookRepository.findByIdOrNull(book4.id)?.let { bookRepository.update(it.copy(fileHash = "hash")) } // not included in changed books if it had no hash before

val syncPoint2 = syncPointLifecycle.createSyncPoint(user1, listOf(library1.id))
val syncPoint2 = syncPointLifecycle.createSyncPoint(user1, null, listOf(library1.id))
val booksChanged = syncPointRepository.findBooksChanged(syncPoint1.id, syncPoint2.id, false, Pageable.unpaged())
val page1 = syncPointLifecycle.takeBooksChanged(syncPoint1.id, syncPoint2.id, PageRequest.ofSize(1))
val page2 = syncPointLifecycle.takeBooksChanged(syncPoint1.id, syncPoint2.id, PageRequest.ofSize(1))
Expand Down

0 comments on commit 89905eb

Please sign in to comment.