Find notes by tags

This commit is contained in:
2020-08-17 16:44:16 +02:00
parent b5beca8661
commit 8021814c31
4 changed files with 38 additions and 4 deletions
@@ -155,6 +155,27 @@ internal class NoteRepositoryImplTest {
.hasSize(10)
.allMatch { it.title.toInt() in 41..50 }
}
@Test
fun `find all notes with tag`() {
createNote(user1.id, "1", listOf("a", "b"))
createNote(user1.id, "2")
createNote(user1.id, "3", listOf("c"))
createNote(user1.id, "4", listOf("c"))
createNote(user2.id, "5", listOf("c"))
assertThat(noteRepo.findAll(user1.id, tag = "a"))
.hasSize(1)
.first()
.hasFieldOrPropertyWithValue("title", "1")
assertThat(noteRepo.findAll(user1.id, tag = "c"))
.hasSize(2)
assertThat(noteRepo.findAll(user2.id, tag = "c"))
.hasSize(1)
}
}
@Nested