11package pro.qyoga.tests.cases.app.therapist.clients.journal
22
3- import io.kotest.inspectors.forAny
4- import io.kotest.inspectors.forNone
53import io.kotest.matchers.shouldBe
4+ import io.kotest.matchers.shouldNotBe
65import org.junit.jupiter.api.DisplayName
76import org.junit.jupiter.api.Test
87import org.springframework.http.HttpStatus
@@ -13,6 +12,7 @@ import pro.qyoga.tests.fixture.object_mothers.clients.ClientsObjectMother
1312import pro.qyoga.tests.fixture.object_mothers.clients.JournalEntriesObjectMother.journalEntry
1413import pro.qyoga.tests.fixture.object_mothers.therapists.THE_THERAPIST_ID
1514import pro.qyoga.tests.fixture.object_mothers.therapists.theTherapistUserDetails
15+ import pro.qyoga.tests.fixture.presets.ClientsFixturePresets
1616import pro.qyoga.tests.infra.web.QYogaAppIntegrationBaseTest
1717import pro.qyoga.tests.pages.publc.GenericErrorPage
1818import pro.qyoga.tests.pages.publc.NotFoundErrorPage
@@ -25,6 +25,8 @@ import java.time.LocalDate
2525@DisplayName(" Странциа редактирования записи журнала" )
2626class EditJournalEntryPageTest : QYogaAppIntegrationBaseTest () {
2727
28+ private val clientFixturePresets = getBean<ClientsFixturePresets >()
29+
2830 @Test
2931 fun `должна рендериться корректно` () {
3032 // Сетап
@@ -44,20 +46,17 @@ class EditJournalEntryPageTest : QYogaAppIntegrationBaseTest() {
4446 @Test
4547 fun `должна сохранять изменения` () {
4648 // Сетап
47- val therapist = TherapistClient .loginAsTheTherapist()
48- val client = backgrounds.clients.createClients(1 , THE_THERAPIST_ID ).first()
49- val createJournalEntryRequest = journalEntry()
50- val entry =
51- backgrounds.clientJournal.createJournalEntry(client.id, createJournalEntryRequest, theTherapistUserDetails)
52- val editedEntry = journalEntry()
49+ val (client, entries) = clientFixturePresets.createAClientWithJournalEntry()
50+ val entry = entries.single()
51+ val editEntryRq = journalEntry()
5352
5453 // Действие
55- therapist .clientJournal.editJournalEntry(client.id, entry.id, editedEntry )
54+ theTherapist .clientJournal.editJournalEntry(client.id, entry.id, editEntryRq )
5655
5756 // Проверка
58- val journal = backgrounds.clientJournal.getWholeJournal(client.id).content
59- journal.forNone { it shouldBe entry }
60- journal.forAny { it shouldMatch editedEntry }
57+ val updatedEntry = backgrounds.clientJournal.getWholeJournal(client.id).content.single()
58+ updatedEntry shouldMatch editEntryRq
59+ updatedEntry.lastModifiedAt shouldNotBe null
6160 }
6261
6362 @Test
0 commit comments