Skip to content

Commit cb4aea8

Browse files
committed
fix/qg-264: включен аудит SDJ-сущностей
1 parent fdfddde commit cb4aea8

2 files changed

Lines changed: 13 additions & 12 deletions

File tree

app/src/main/kotlin/pro/qyoga/infra/db/SdjConfig.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@ package pro.qyoga.infra.db
22

33
import org.springframework.context.annotation.Configuration
44
import org.springframework.data.jdbc.repository.config.AbstractJdbcConfiguration
5+
import org.springframework.data.jdbc.repository.config.EnableJdbcAuditing
56
import pro.azhidkov.platform.spring.sdj.converters.*
67

78

9+
@EnableJdbcAuditing
810
@Configuration
911
class SdjConfig(
1012
private val modulesConverters: List<ModuleConverters>

app/src/test/kotlin/pro/qyoga/tests/cases/app/therapist/clients/journal/EditJournalEntryPageTest.kt

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
package pro.qyoga.tests.cases.app.therapist.clients.journal
22

3-
import io.kotest.inspectors.forAny
4-
import io.kotest.inspectors.forNone
53
import io.kotest.matchers.shouldBe
4+
import io.kotest.matchers.shouldNotBe
65
import org.junit.jupiter.api.DisplayName
76
import org.junit.jupiter.api.Test
87
import org.springframework.http.HttpStatus
@@ -13,6 +12,7 @@ import pro.qyoga.tests.fixture.object_mothers.clients.ClientsObjectMother
1312
import pro.qyoga.tests.fixture.object_mothers.clients.JournalEntriesObjectMother.journalEntry
1413
import pro.qyoga.tests.fixture.object_mothers.therapists.THE_THERAPIST_ID
1514
import pro.qyoga.tests.fixture.object_mothers.therapists.theTherapistUserDetails
15+
import pro.qyoga.tests.fixture.presets.ClientsFixturePresets
1616
import pro.qyoga.tests.infra.web.QYogaAppIntegrationBaseTest
1717
import pro.qyoga.tests.pages.publc.GenericErrorPage
1818
import pro.qyoga.tests.pages.publc.NotFoundErrorPage
@@ -25,6 +25,8 @@ import java.time.LocalDate
2525
@DisplayName("Странциа редактирования записи журнала")
2626
class 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

Comments
 (0)