API 1.0.35+2 tutorial_step condition as JSON

This commit is contained in:
Bossanyi Tibor
2021-04-30 23:00:13 +02:00
parent 8269e8b4a0
commit e7c9cdc153
4 changed files with 6 additions and 20 deletions
@@ -13,12 +13,8 @@ data class TutorialSteps (
@Expose @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @get: NonNull var tutorialStepId: Long = 0,
@Expose @get: NotBlank var tutorialText: String = "",
@Expose @get: NotBlank var step: Int = 0,
@Expose var direction: String? = null,
@Expose var checkText: String? = null,
@Expose var condition: String? = null,
@Expose var branch: String? = null,
@Expose @get: NotBlank var parent_id: Int = 0,
@Expose var action: Int? = 0,
) {
@ManyToOne(fetch = FetchType.LAZY, optional = false)
@@ -11,7 +11,6 @@ data class TutorialTranslation (
@Expose @get: NotBlank var languageCode: String?,
@Expose @get: NotBlank var tutorialText: String = "",
@Expose var errorText: String? = null,
) {
@ManyToOne(fetch = FetchType.LAZY, optional = false)
@@ -133,16 +133,11 @@ class AppPackageTest {
val tutorialJson: String = record[1]
val type = object : TypeToken<List<Tutorial?>?>() {}.type
val tutorials: List<Tutorial> = gson.fromJson(tutorialJson, type)
assertEquals(tutorials.size, 1)
assertEquals(tutorials.size, 2)
assertEquals(tutorials[0].name, "Basic")
assertEquals(tutorials[0].steps.size, 5)
assertEquals(tutorials[0].steps[3].parent_id, 2)
assertEquals(tutorials[0].steps[3].condition, "Check2")
assertEquals(tutorials[0].steps[2].direction, "up|88")
assertEquals(tutorials[0].steps[3].action, 0)
assertEquals(tutorials[0].steps[4].action, 1)
assertEquals(tutorials[0].steps[4].branch, "Check1")
assertEquals(tutorials[0].steps[0].translations.size, 2)
assertEquals(tutorials[0].steps.size, 9)
assertEquals(tutorials[0].steps[2].condition, "{\"direction\":\"down\",\"top\":95,\"left\":-1,\"show_bubble\":false,\"bubble_x\":220,\"bubble_y\":220,\"bubble_width\":440,\"bubble_height\":440,\"show_check_text\":false,\"parent\":2}")
assertEquals(tutorials[0].steps[0].translations.size, 1)
}
}