Use Kotest matchers in other test classes
This commit is contained in:
parent
8ab7e63293
commit
d6b9711e45
@ -1,6 +1,6 @@
|
|||||||
package tachiyomi.domain.chapter.service
|
package tachiyomi.domain.chapter.service
|
||||||
|
|
||||||
import org.junit.jupiter.api.Assertions.assertEquals
|
import io.kotest.matchers.shouldBe
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.junit.jupiter.api.parallel.Execution
|
import org.junit.jupiter.api.parallel.Execution
|
||||||
import org.junit.jupiter.api.parallel.ExecutionMode
|
import org.junit.jupiter.api.parallel.ExecutionMode
|
||||||
@ -261,7 +261,6 @@ class ChapterRecognitionTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun assertChapter(mangaTitle: String, name: String, expected: Float) {
|
private fun assertChapter(mangaTitle: String, name: String, expected: Float) {
|
||||||
val chapterNumber = ChapterRecognition.parseChapterNumber(mangaTitle, name)
|
ChapterRecognition.parseChapterNumber(mangaTitle, name) shouldBe expected
|
||||||
assertEquals(chapterNumber, expected)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,19 @@
|
|||||||
package tachiyomi.domain.library.model
|
package tachiyomi.domain.library.model
|
||||||
|
|
||||||
import org.junit.jupiter.api.Assertions.assertEquals
|
import io.kotest.matchers.shouldBe
|
||||||
import org.junit.jupiter.api.Assertions.assertNotEquals
|
import io.kotest.matchers.shouldNotBe
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
import org.junit.jupiter.api.parallel.Execution
|
||||||
|
import org.junit.jupiter.api.parallel.ExecutionMode
|
||||||
|
|
||||||
|
@Execution(ExecutionMode.CONCURRENT)
|
||||||
class LibraryFlagsTest {
|
class LibraryFlagsTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `Check the amount of flags`() {
|
fun `Check the amount of flags`() {
|
||||||
assertEquals(4, LibraryDisplayMode.values.size)
|
LibraryDisplayMode.values.size shouldBe 4
|
||||||
assertEquals(8, LibrarySort.types.size)
|
LibrarySort.types.size shouldBe 8
|
||||||
assertEquals(2, LibrarySort.directions.size)
|
LibrarySort.directions.size shouldBe 2
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -19,7 +22,7 @@ class LibraryFlagsTest {
|
|||||||
val new = LibraryDisplayMode.CoverOnlyGrid
|
val new = LibraryDisplayMode.CoverOnlyGrid
|
||||||
val flag = current + new
|
val flag = current + new
|
||||||
|
|
||||||
assertEquals(0b00000011, flag)
|
flag shouldBe 0b00000011
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -28,7 +31,7 @@ class LibraryFlagsTest {
|
|||||||
val new = LibrarySort(LibrarySort.Type.DateAdded, LibrarySort.Direction.Ascending)
|
val new = LibrarySort(LibrarySort.Type.DateAdded, LibrarySort.Direction.Ascending)
|
||||||
val flag = current + new
|
val flag = current + new
|
||||||
|
|
||||||
assertEquals(0b01011100, flag)
|
flag shouldBe 0b01011100
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -37,7 +40,7 @@ class LibraryFlagsTest {
|
|||||||
val sort = LibrarySort(LibrarySort.Type.DateAdded, LibrarySort.Direction.Ascending)
|
val sort = LibrarySort(LibrarySort.Type.DateAdded, LibrarySort.Direction.Ascending)
|
||||||
val flag = display + sort
|
val flag = display + sort
|
||||||
|
|
||||||
assertEquals(0b01011111, flag)
|
flag shouldBe 0b01011111
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -50,9 +53,9 @@ class LibraryFlagsTest {
|
|||||||
val sort = LibrarySort(LibrarySort.Type.DateAdded, LibrarySort.Direction.Ascending)
|
val sort = LibrarySort(LibrarySort.Type.DateAdded, LibrarySort.Direction.Ascending)
|
||||||
val flag = currentFlag + display + sort
|
val flag = currentFlag + display + sort
|
||||||
|
|
||||||
assertEquals(0b00001110, currentFlag)
|
currentFlag shouldBe 0b00001110
|
||||||
assertEquals(0b01011111, flag)
|
flag shouldBe 0b01011111
|
||||||
assertNotEquals(currentFlag, flag)
|
flag shouldNotBe currentFlag
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -61,6 +64,6 @@ class LibraryFlagsTest {
|
|||||||
val display = LibraryDisplayMode.default
|
val display = LibraryDisplayMode.default
|
||||||
val flag = display + sort.type + sort.direction
|
val flag = display + sort.type + sort.direction
|
||||||
|
|
||||||
assertEquals(0b01000000, flag)
|
flag shouldBe 0b01000000
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user