Skip to content

Commit

Permalink
chore: Make asserts of websocket tests more concise (#2848)
Browse files Browse the repository at this point in the history
  • Loading branch information
StaNov authored Jan 16, 2025
1 parent c751b09 commit 3c9ad1c
Showing 1 changed file with 29 additions and 69 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,25 +56,14 @@ abstract class AbstractWebsocketTest : ProjectAuthControllerTest("/v2/projects/"
},
) {
assertThatJson(it.poll()).apply {
node("actor") {
node("data") {
node("username").isEqualTo("test_username")
}
}
node("data") {
node("keys") {
isArray
node("[0]") {
node("id").isValidId
node("modifications") {
node("name") {
node("old").isEqualTo("key")
node("new").isEqualTo("name edited")
}
}
node("changeType").isEqualTo("MOD")
}
node("actor.data.username").isEqualTo("test_username")
node("data.keys[0]") {
node("id").isValidId
node("modifications.name") {
node("old").isEqualTo("key")
node("new").isEqualTo("name edited")
}
node("changeType").isEqualTo("MOD")
}
node("sourceActivity").isEqualTo("KEY_NAME_EDIT")
node("dataCollapsed").isEqualTo(false)
Expand All @@ -91,20 +80,13 @@ abstract class AbstractWebsocketTest : ProjectAuthControllerTest("/v2/projects/"
},
) {
assertThatJson(it.poll()).apply {
node("data") {
node("keys") {
isArray
node("[0]") {
node("id").isValidId
node("modifications") {
node("name") {
node("old").isEqualTo("key")
node("new").isEqualTo(null)
}
}
node("changeType").isEqualTo("DEL")
}
node("data.keys[0]") {
node("id").isValidId
node("modifications.name") {
node("old").isEqualTo("key")
node("new").isEqualTo(null)
}
node("changeType").isEqualTo("DEL")
}
}
}
Expand All @@ -119,20 +101,13 @@ abstract class AbstractWebsocketTest : ProjectAuthControllerTest("/v2/projects/"
},
) {
assertThatJson(it.poll()).apply {
node("data") {
node("keys") {
isArray
node("[0]") {
node("id").isValidId
node("modifications") {
node("name") {
node("old").isEqualTo(null)
node("new").isEqualTo("new key")
}
}
node("changeType").isEqualTo("ADD")
}
node("data.keys[0]") {
node("id").isValidId
node("modifications.name") {
node("old").isEqualTo(null)
node("new").isEqualTo("new key")
}
node("changeType").isEqualTo("ADD")
}
}
}
Expand All @@ -153,32 +128,17 @@ abstract class AbstractWebsocketTest : ProjectAuthControllerTest("/v2/projects/"
},
) {
assertThatJson(it.poll()).apply {
node("data") {
node("translations") {
isArray
node("[0]") {
node("id").isValidId
node("modifications") {
node("text") {
node("old").isEqualTo("translation")
node("new").isEqualTo("haha")
}
}
node("relations") {
node("key") {
node("data") {
node("name").isEqualTo("key")
}
}
node("language") {
node("data") {
node("name").isEqualTo("English")
}
}
}
node("changeType").isEqualTo("MOD")
}
node("data.translations[0]") {
node("id").isValidId
node("modifications.text") {
node("old").isEqualTo("translation")
node("new").isEqualTo("haha")
}
node("relations") {
node("key.data.name").isEqualTo("key")
node("language.data.name").isEqualTo("English")
}
node("changeType").isEqualTo("MOD")
}
}
}
Expand Down

0 comments on commit 3c9ad1c

Please sign in to comment.