Skip to content

Commit

Permalink
chore: add task filter test
Browse files Browse the repository at this point in the history
  • Loading branch information
stepan662 committed Jan 13, 2025
1 parent 5bd0d1c commit a56b6a8
Showing 1 changed file with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.springframework.beans.factory.annotation.Autowired
import java.math.BigDecimal
import java.time.Instant
import java.time.ZonedDateTime

class TaskControllerTest : ProjectAuthControllerTest("/v2/projects/") {
lateinit var testData: TaskTestData
Expand Down Expand Up @@ -355,4 +357,32 @@ class TaskControllerTest : ProjectAuthControllerTest("/v2/projects/") {
node("state").isEqualTo("NEW")
}
}

@Test
@ProjectJWTAuthTestMethod
fun `closed tasks can be filtered out by timestamp`() {
val timeBeforeCreation = System.currentTimeMillis()
performProjectAuthPut(
"tasks/${testData.translateTask.self.number}/close",
).andIsOk.andAssertThatJson {
node("state").isEqualTo("CLOSED")
}
val timeAfterCreation = System.currentTimeMillis()

// should be included
performProjectAuthGet(
"tasks?filterNotClosedBefore=${timeBeforeCreation}",
).andIsOk.andAssertThatJson {
node("page").node("totalElements").isEqualTo(2)
node("_embedded.tasks[0].name").isEqualTo("Translate task")
}

// should be excluded
performProjectAuthGet(
"tasks?filterNotClosedBefore=${timeAfterCreation}",
).andIsOk.andAssertThatJson {
node("page").node("totalElements").isEqualTo(1)
node("_embedded.tasks[0].name").isEqualTo("Review task")
}
}
}

0 comments on commit a56b6a8

Please sign in to comment.