Skip to content

Commit

Permalink
replace dynatest with junit5
Browse files Browse the repository at this point in the history
  • Loading branch information
mvysny committed Oct 28, 2024
1 parent 22bbb8c commit 33981d5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ import org.junit.jupiter.api.Nested
*/
@DynaTestDsl
fun DynaNodeGroup.allTests19(isModuleTest: Boolean) {
group("Grid Vaadin 19+") {
grid19Testbatch()
}

group("security") {
securityTests()
}
Expand Down Expand Up @@ -44,4 +40,5 @@ fun DynaNodeGroup.allTests19(isModuleTest: Boolean) {

abstract class AbstractAllTests19(val isModuleTest: Boolean) {
@Nested inner class AllTests10 : AbstractAllTests10(isModuleTest)
@Nested inner class GridVaadin19Tests : AbstractGrid19Tests()
}
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
package com.github.mvysny.kaributesting.v10

import com.github.mvysny.dynatest.DynaNodeGroup
import com.github.mvysny.dynatest.DynaTestDsl
import com.github.mvysny.dynatest.expectThrows
import com.github.mvysny.karibudsl.v10.grid
import com.vaadin.flow.component.UI
import com.vaadin.flow.component.grid.Grid
import com.vaadin.flow.data.provider.CallbackDataProvider
import org.junit.jupiter.api.AfterEach
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Nested
import org.junit.jupiter.api.Test
import kotlin.test.expect

@DynaTestDsl
fun DynaNodeGroup.grid19Testbatch() {
beforeEach { MockVaadin.setup() }
afterEach { MockVaadin.tearDown() }
abstract class AbstractGrid19Tests() {
@BeforeEach fun fakeVaadin() { MockVaadin.setup() }
@AfterEach fun tearDownVaadin() { MockVaadin.tearDown() }

group("FetchCallback with no size info") {
group("_get") {
@Nested inner class `FetchCallback with no size info` {
@Nested inner class _get {
// https://github.com/mvysny/karibu-testing/issues/72
test("offset/limit") {
@Test fun `offset-limit`() {
val grid: Grid<String> = UI.getCurrent().grid<String> {
setItems(CallbackDataProvider.FetchCallback<String, Void> { query ->
listOf("a", "b", "c").stream()
Expand All @@ -28,7 +29,7 @@ fun DynaNodeGroup.grid19Testbatch() {
expect("b") { grid._get(1) }
expect(null) { grid._getOrNull(4) }
}
test("paging") {
@Test fun paging() {
// https://github.com/mvysny/karibu-testing/issues/99
val grid: Grid<Int> = UI.getCurrent().grid<Int> {
setItems(CallbackDataProvider.FetchCallback<Int, Void> { query ->
Expand All @@ -44,8 +45,8 @@ fun DynaNodeGroup.grid19Testbatch() {
}
}

group("_dump") {
test("3 items") {
@Nested inner class _dump {
@Test fun `3 items`() {
val grid: Grid<String> = UI.getCurrent().grid<String> {
addColumn { it }
setItems(CallbackDataProvider.FetchCallback<String, Void> { query ->
Expand All @@ -65,7 +66,7 @@ fun DynaNodeGroup.grid19Testbatch() {
"""
) { grid._dump() }
}
test("30 items") {
@Test fun `30 items`() {
val grid: Grid<String> = UI.getCurrent().grid<String> {
addColumn { it }
setItems(CallbackDataProvider.FetchCallback<String, Void> { query ->
Expand Down Expand Up @@ -94,7 +95,7 @@ fun DynaNodeGroup.grid19Testbatch() {
}
}

test("_expectRows") {
@Test fun _expectRows() {
val grid: Grid<String> = UI.getCurrent().grid<String> {
setItems(CallbackDataProvider.FetchCallback<String, Void> { query ->
(0..29).map { it.toString() }.stream()
Expand Down

0 comments on commit 33981d5

Please sign in to comment.