Update config
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package be.simplenotes.search
|
||||
|
||||
import be.simplenotes.types.NoteMetadata
|
||||
import be.simplenotes.types.PersistedNote
|
||||
import be.simplenotes.types.PersistedNoteMetadata
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
@@ -9,6 +8,7 @@ import org.junit.jupiter.api.AfterAll
|
||||
import org.junit.jupiter.api.BeforeEach
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.junit.jupiter.api.parallel.ResourceLock
|
||||
import java.nio.file.Path
|
||||
import java.time.LocalDateTime
|
||||
import java.util.*
|
||||
|
||||
@@ -16,7 +16,7 @@ import java.util.*
|
||||
internal class NoteSearcherImplTest {
|
||||
|
||||
// region setup
|
||||
private val searcher = NoteSearcherImpl()
|
||||
private val searcher = NoteSearcherImpl(Path.of("/tmp", "lucene"))
|
||||
|
||||
private fun index(
|
||||
title: String,
|
||||
@@ -25,11 +25,12 @@ internal class NoteSearcherImplTest {
|
||||
uuid: UUID = UUID.randomUUID(),
|
||||
): PersistedNote {
|
||||
val note = PersistedNote(
|
||||
NoteMetadata(title, tags),
|
||||
title = title,
|
||||
tags = tags,
|
||||
markdown = content,
|
||||
html = "",
|
||||
LocalDateTime.MIN,
|
||||
uuid,
|
||||
updatedAt = LocalDateTime.MIN,
|
||||
uuid = uuid,
|
||||
public = false
|
||||
)
|
||||
searcher.indexNote(1, note)
|
||||
@@ -150,7 +151,7 @@ internal class NoteSearcherImplTest {
|
||||
@Test
|
||||
fun `update index`() {
|
||||
val note = index("first")
|
||||
searcher.updateIndex(1, note.copy(meta = note.meta.copy(title = "new")))
|
||||
searcher.updateIndex(1, note.copy(title = "new"))
|
||||
assertThat(search("first")).isEmpty()
|
||||
assertThat(search("new")).hasSize(1)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user