mirror of
https://github.com/MewoLab/AquaDX.git
synced 2026-02-06 10:57:27 +08:00
[+] Wacca: Fix test inconsistency, error handling
This commit is contained in:
@@ -32,11 +32,33 @@ class WaccaTest : StringSpec({
|
||||
// Replace all timestamps as null
|
||||
val start = millis().toString().substring(0..3)
|
||||
val lst = this.toJson().replace(Regex("""$start\d{6}(?=[], ])"""), "null").jsonArray()
|
||||
lst shouldBe expected
|
||||
val exp = expected.toJson().replace(Regex("""$start\d{6}(?=[], ])"""), "null").jsonArray()
|
||||
lst shouldBe exp
|
||||
}
|
||||
|
||||
infix fun List<Any?>.exp(json: String) = exp(json.jsonArray())
|
||||
|
||||
infix fun List<Any?>.expGetDetail(json: String) {
|
||||
val start = millis().toString().substring(0..3)
|
||||
val lst = this.toJson().replace(Regex("""$start\d{6}(?=[], ])"""), "null").jsonArray()
|
||||
val exp = json.replace(Regex("""$start\d{6}(?=[], ])"""), "null").jsonArray()
|
||||
|
||||
// Check each ordered element
|
||||
listOf(0, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17).forEach { i ->
|
||||
(lst[i] to i) shouldBe (exp[i] to i)
|
||||
}
|
||||
|
||||
// Check each unordered element
|
||||
listOf(1, 2, 4, ).forEach { i ->
|
||||
((lst[i] as List<*>).toSet() to i) shouldBe ((exp[i] as List<*>).toSet() to i)
|
||||
}
|
||||
|
||||
// Check items (unordered element inside ordered element)
|
||||
val setSrc = (lst[3] as List<*>).map { (it as List<*>).toSet() }
|
||||
val setExp = (exp[3] as List<*>).map { (it as List<*>).toSet() }
|
||||
setSrc shouldBe setExp
|
||||
}
|
||||
|
||||
System.getProperty("kotest.assertions.collection.print.size", "1000")
|
||||
|
||||
beforeTest {
|
||||
@@ -59,12 +81,12 @@ class WaccaTest : StringSpec({
|
||||
|
||||
"user/status/get #1" {
|
||||
post("user/status/get", """["$uid"]""").res exp
|
||||
"""[[0, "", 1, 0, 0, 0, 0, [0, 0, 0], 0, 0, 0, 0, 3376684800, 0, 0], 104001, 102001, 1, [2, "1.0.0"], []]"""
|
||||
"""[[0, "", 1, 0, 0, 0, 500, [0, 0, 0], 0, 0, 0, 0, 3376684800, 0, 0], 104001, 102001, 1, [2, "1.0.0"], []]"""
|
||||
}
|
||||
|
||||
"user/status/create #1" {
|
||||
post("user/status/create", """["$uid", "AZA"]""").res exp
|
||||
"""[[$uid, "AZA", 1, 0, 0, 0, 0, [0, 0, 0], 0, 0, 0, 0, 3376684800, 0, 0]]"""
|
||||
"""[[$uid, "AZA", 1, 0, 0, 0, 500, [0, 0, 0], 0, 0, 0, 0, 3376684800, 0, 0]]"""
|
||||
}
|
||||
|
||||
"user/status/login Guest" {
|
||||
@@ -78,8 +100,8 @@ class WaccaTest : StringSpec({
|
||||
}
|
||||
|
||||
"user/status/getDetail #1" {
|
||||
post("user/status/getDetail", "[$uid]").res exp
|
||||
"""[[$uid, "AZA", 1, 0, 0, 0, 999999, [0, 0, 0], 1, 1, 0, 1, 3376684800, 1, 0], [], [[3, 1, 0], [3, 2, 0], [3, 3, 0], [3, 4, 0], [3, 5, 0], [0, 1, 1]], [[], [[104001, 1, null], [104002, 1, null], [104003, 1, null], [104005, 1, null]], [[102001, 1, 0, null], [102002, 1, 0, null]], [], [], [], [[103001, 1, null], [203001, 1, null]], [[105001, 1, null], [205005, 1, null]], [[210001, 1, null, 0, 0], [210002, 1, null, 0, 0], [210054, 1, null, 0, 0], [210055, 1, null, 0, 0], [210056, 1, null, 0, 0], [210057, 1, null, 0, 0], [210058, 1, null, 0, 0], [210059, 1, null, 0, 0], [210060, 1, null, 0, 0], [210061, 1, null, 0, 0], [310001, 1, null, 0, 0], [310002, 1, null, 0, 0]], [[211001, 1, null]], [[312000, 1, null], [312001, 1, null]]], [], [0, 1], [0, 0, 0, 0, 4, 2, 0, 2, 2, 1, 0], [[0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0]], null, [], [], [], [[1, 1, 1, 0, 0, 0, 0], [2, 1, 1, 0, 0, 0, 0], [3, 1, 1, 0, 0, 0, 0], [4, 1, 1, 0, 0, 0, 0], [5, 1, 1, 0, 0, 0, 0], [6, 1, 1, 0, 0, 0, 0], [7, 1, 1, 0, 0, 0, 0], [8, 1, 1, 0, 0, 0, 0], [9, 1, 1, 0, 0, 0, 0], [10, 1, 1, 0, 0, 0, 0], [11, 1, 1, 0, 0, 0, 0], [12, 1, 1, 0, 0, 0, 0], [13, 1, 1, 0, 0, 0, 0], [14, 1, 1, 0, 0, 0, 0], [15, 1, 1, 0, 0, 0, 0], [16, 1, 1, 0, 0, 0, 0], [17, 1, 1, 0, 0, 0, 0], [18, 1, 1, 0, 0, 0, 0], [19, 1, 1, 0, 0, 0, 0], [20, 1, 1, 0, 0, 0, 0], [21, 1, 1, 0, 0, 0, 0], [22, 1, 1, 0, 0, 0, 0], [23, 1, 1, 0, 0, 0, 0], [24, 1, 1, 0, 0, 0, 0]], [0, 0, 0, 0, 0], [[1, 0], [2, 0], [3, 0], [4, 0], [5, 0]], [], [], [0, []]]"""
|
||||
post("user/status/getDetail", "[$uid]").res expGetDetail
|
||||
"""[[$uid, "AZA", 1, 0, 0, 0, 500, [0, 0, 0], 1, 1, 0, 1, 3376684800, 1, 0], [], [[3, 1, 0], [3, 2, 0], [3, 3, 0], [3, 4, 0], [3, 5, 0], [0, 1, 1]], [[], [[104001, 1, null], [104002, 1, null], [104003, 1, null], [104005, 1, null]], [[102001, 1, 0, null], [102002, 1, 0, null]], [], [], [], [[103001, 1, null], [203001, 1, null]], [[105001, 1, null], [205005, 1, null]], [[210001, 1, null, 0, 0], [210002, 1, null, 0, 0], [210054, 1, null, 0, 0], [210055, 1, null, 0, 0], [210056, 1, null, 0, 0], [210057, 1, null, 0, 0], [210058, 1, null, 0, 0], [210059, 1, null, 0, 0], [210060, 1, null, 0, 0], [210061, 1, null, 0, 0], [310001, 1, null, 0, 0], [310002, 1, null, 0, 0]], [[211001, 1, null]], [[312000, 1, null], [312001, 1, null]]], [], [0, 1], [0, 500, 0, 0, 4, 2, 0, 2, 2, 1, 0], [[0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0]], null, [], [], [], [[1, 1, 1, 0, 0, 0, 0], [2, 1, 1, 0, 0, 0, 0], [3, 1, 1, 0, 0, 0, 0], [4, 1, 1, 0, 0, 0, 0], [5, 1, 1, 0, 0, 0, 0], [6, 1, 1, 0, 0, 0, 0], [7, 1, 1, 0, 0, 0, 0], [8, 1, 1, 0, 0, 0, 0], [9, 1, 1, 0, 0, 0, 0], [10, 1, 1, 0, 0, 0, 0], [11, 1, 1, 0, 0, 0, 0], [12, 1, 1, 0, 0, 0, 0], [13, 1, 1, 0, 0, 0, 0], [14, 1, 1, 0, 0, 0, 0], [15, 1, 1, 0, 0, 0, 0], [16, 1, 1, 0, 0, 0, 0], [17, 1, 1, 0, 0, 0, 0], [18, 1, 1, 0, 0, 0, 0], [19, 1, 1, 0, 0, 0, 0], [20, 1, 1, 0, 0, 0, 0], [21, 1, 1, 0, 0, 0, 0], [22, 1, 1, 0, 0, 0, 0], [23, 1, 1, 0, 0, 0, 0], [24, 1, 1, 0, 0, 0, 0]], [0, 0, 0, 0, 0], [[1, 0], [2, 0], [3, 0], [4, 0], [5, 0]], [], [], [0, []]]"""
|
||||
}
|
||||
|
||||
"user/sugoroku/update #1" {
|
||||
@@ -126,5 +148,59 @@ class WaccaTest : StringSpec({
|
||||
post("user/music/update", "[$uid, 3, [1111, 2, 10.899999618530273, 900776, [484, 128, 13, 19], 157, 7, 1, 0, 0, 0, 0, 0, 15, 126, 1], [[2, 0, 1224], [4, 1111, 3]]]").res exp
|
||||
"[[1111, 2, [1, 1, 0, 0, 0], [1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], 900776, 19, 0, 1, 108], [1111, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], []]"
|
||||
}
|
||||
|
||||
"user/status/update #2" {
|
||||
post("user/status/update", "[$uid, 1, [[1, 0, 100], [2, 0, 250], [5, 104078, 1], [5, 104125, 1], [7, 301001, 1000], [7, 301002, 300], [7, 301003, 100]], 0, 0, [], [1111, 2, 1, 5, 2]]").res exp
|
||||
"[]"
|
||||
}
|
||||
|
||||
"user/rating/update #1" {
|
||||
post("user/rating/update", "[$uid, 497, [[1116, 2, 97], [2074, 3, 0], [2074, 2, 182], [1111, 3, 0], [1111, 2, 218]]]").res exp
|
||||
"[]"
|
||||
}
|
||||
|
||||
"user/info/getMyroom #1" {
|
||||
post("user/info/getMyroom", "[$uid]").res exp
|
||||
"[0, 0, 0, 0, 0, [], 0, 0, 0]"
|
||||
}
|
||||
|
||||
"user/info/update #1" {
|
||||
post("user/info/update", "[$uid, [[1, 38], [2, 3], [108, 94]], [], [], [], []]").res exp
|
||||
"[]"
|
||||
}
|
||||
|
||||
"user/status/logout #2" {
|
||||
post("user/status/logout", "[$uid]").res exp
|
||||
"[]"
|
||||
}
|
||||
|
||||
"user/status/get #2" {
|
||||
post("user/status/get", """["$uid"]""").res exp
|
||||
"""[[$uid, "AZA", 1, 100, 0, 0, 4134, [0, 0, 0], 1, 1, 0, 1, 3376684800, 1, 497], 104001, 102001, 0, [0, "3.7.1"], [[1, 38], [2, 3], [108, 94]]]"""
|
||||
}
|
||||
|
||||
"user/status/login #3" {
|
||||
post("user/status/login", "[$uid]").res exp
|
||||
"[[], [], [], 0, [2077, 1, 1, 1, [], []], null, []]"
|
||||
}
|
||||
|
||||
"user/status/getDetail #2" {
|
||||
post("user/status/getDetail", "[$uid]").res expGetDetail
|
||||
"""[[$uid, "AZA", 1, 100, 0, 0, 4134, [0, 0, 0], 2, 1, 1, 1, 3376684800, 2, 497], [[1, 38], [2, 3], [108, 94]], [[3, 1, 1], [3, 2, 0], [3, 3, 0], [3, 4, 0], [3, 5, 0], [0, 1, 1]], [[[1111, 1, 0, 1711419516], [1111, 2, 0, 1711419516], [1111, 3, 0, 1711419516], [2074, 1, 0, 1711419238], [2074, 2, 0, 1711419238], [2074, 3, 0, 1711419238]], [[104001, 1, 1711418627], [104002, 1, 1711418627], [104003, 1, 1711418627], [104005, 1, 1711418627], [304129, 1, 1711419172], [104078, 1, 1711419526], [104125, 1, 1711419526]], [[102001, 1, 1, 1711418627], [102002, 1, 0, 1711418627], [302027, 1, 0, 1711418927], [302030, 1, 0, 1711419486]], [[301001, 3, 1000, 0], [301002, 3, 300, 0], [301003, 3, 100, 0]], [], [[0, 106002, 0], [1, 106002, 0], [2, 106002, 0], [3, 106002, 0], [4, 106002, 0]], [[103001, 1, 1711418627], [203001, 1, 1711418627]], [[105001, 1, 1711418627], [205005, 1, 1711418627]], [[210001, 1, 1711418627, 0, 0], [210002, 1, 1711418627, 0, 0], [210054, 1, 1711418627, 0, 0], [210055, 1, 1711418627, 0, 0], [210056, 1, 1711418627, 0, 0], [210057, 1, 1711418627, 0, 0], [210058, 1, 1711418627, 0, 0], [210059, 1, 1711418627, 0, 0], [210060, 1, 1711418627, 0, 0], [210061, 1, 1711418627, 0, 0], [310001, 1, 1711418627, 1, 1], [310002, 1, 1711418627, 0, 0]], [[211001, 1, 1711418627]], [[312000, 1, 1711418627], [312001, 1, 1711418627]]], [[1116, 2, [1, 1, 0, 0, 0], [1, 1, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], 812201, 56, 33, 1, 97], [2074, 3, [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 0, 0, 0, 1, 0], [2074, 2, [1, 1, 0, 0, 0], [1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], 903346, 77, 11, 1, 182], [1111, 3, [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 0, 0, 0, 1, 0], [1111, 2, [1, 1, 0, 0, 0], [1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], 900776, 157, 19, 1, 218]], [1111, 1], [100, 4134, 0, 2616323, 7, 4, 0, 2, 2, 1, 324], [[0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0]], 1711422586, [], [], [], [[1, 1, 1, 0, 0, 0, 0], [2, 1, 1, 0, 0, 0, 0], [3, 1, 1, 0, 0, 0, 0], [4, 1, 1, 0, 0, 0, 0], [5, 1, 1, 0, 0, 0, 0], [6, 1, 1, 0, 0, 0, 0], [7, 1, 1, 0, 0, 0, 0], [8, 1, 1, 0, 0, 0, 0], [9, 1, 1, 0, 0, 0, 0], [10, 1, 1, 0, 0, 0, 0], [11, 1, 1, 0, 0, 0, 0], [12, 1, 1, 0, 0, 0, 0], [13, 1, 1, 0, 0, 0, 0], [14, 1, 1, 0, 0, 0, 0], [15, 1, 1, 0, 0, 0, 0], [16, 1, 1, 0, 0, 0, 0], [17, 1, 1, 0, 0, 0, 0], [18, 1, 1, 0, 0, 0, 0], [19, 1, 1, 0, 0, 0, 0], [20, 1, 1, 0, 0, 0, 0], [21, 1, 1, 0, 0, 0, 0], [22, 1, 1, 0, 0, 0, 0], [23, 1, 4, 90, 0, 1711418927, 0], [24, 1, 1, 0, 0, 0, 0]], [1111, 2, 1, 5, 2], [[1, 1], [2, 1], [3, 1], [4, 1], [5, 0]], [], [], [1, [[0, 1, 1], [1, 2, 0], [2, 3, 0], [3, 4, 0], [4, 5, 0], [5, 6, 0], [6, 7, 0], [7, 8, 800], [8, 9, 2000000]]]]"""
|
||||
}
|
||||
|
||||
"user/status/get #3" {
|
||||
post("user/status/get", """["$uid"]""").res exp
|
||||
"""[[$uid, "AZA", 1, 100, 0, 0, 4134, [0, 0, 0], 2, 1, 1, 1, 3376684800, 2, 497], 104001, 102001, 0, [0, "3.7.1"], [[1, 38], [2, 3], [108, 94]]]"""
|
||||
}
|
||||
|
||||
"user/status/login #4" {
|
||||
post("user/status/login", "[$uid]").res exp
|
||||
"[[], [], [], 0, [2077, 1, 1, 1, [], []], null, []]"
|
||||
}
|
||||
|
||||
"user/status/getDetail #3" {
|
||||
post("user/status/getDetail", "[$uid]").res expGetDetail
|
||||
"""[[$uid, "AZA", 1, 100, 0, 0, 4134, [0, 0, 0], 3, 1, 2, 1, 3376684800, 3, 497], [[1, 38], [2, 3], [108, 94]], [[3, 1, 1], [3, 2, 0], [3, 3, 0], [3, 4, 0], [3, 5, 0], [0, 1, 1]], [[[1111, 1, 0, 1711419516], [1111, 2, 0, 1711419516], [1111, 3, 0, 1711419516], [2074, 1, 0, 1711419238], [2074, 2, 0, 1711419238], [2074, 3, 0, 1711419238]], [[104001, 1, 1711418627], [104002, 1, 1711418627], [104003, 1, 1711418627], [104005, 1, 1711418627], [304129, 1, 1711419172], [104078, 1, 1711419526], [104125, 1, 1711419526]], [[102001, 1, 1, 1711418627], [102002, 1, 0, 1711418627], [302027, 1, 0, 1711418927], [302030, 1, 0, 1711419486]], [[301001, 3, 1000, 0], [301002, 3, 300, 0], [301003, 3, 100, 0]], [], [[0, 106002, 0], [1, 106002, 0], [2, 106002, 0], [3, 106002, 0], [4, 106002, 0]], [[103001, 1, 1711418627], [203001, 1, 1711418627]], [[105001, 1, 1711418627], [205005, 1, 1711418627]], [[210001, 1, 1711418627, 0, 0], [210002, 1, 1711418627, 0, 0], [210054, 1, 1711418627, 0, 0], [210055, 1, 1711418627, 0, 0], [210056, 1, 1711418627, 0, 0], [210057, 1, 1711418627, 0, 0], [210058, 1, 1711418627, 0, 0], [210059, 1, 1711418627, 0, 0], [210060, 1, 1711418627, 0, 0], [210061, 1, 1711418627, 0, 0], [310001, 1, 1711418627, 1, 1], [310002, 1, 1711418627, 0, 0]], [[211001, 1, 1711418627]], [[312000, 1, 1711418627], [312001, 1, 1711418627]]], [[1116, 2, [1, 1, 0, 0, 0], [1, 1, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], 812201, 56, 33, 1, 97], [2074, 3, [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 0, 0, 0, 1, 0], [2074, 2, [1, 1, 0, 0, 0], [1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], 903346, 77, 11, 1, 182], [1111, 3, [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 0, 0, 0, 1, 0], [1111, 2, [1, 1, 0, 0, 0], [1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], 900776, 157, 19, 1, 218]], [1111, 1], [100, 4134, 0, 2616323, 7, 4, 0, 2, 2, 1, 324], [[0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0]], 1711422954, [], [], [], [[1, 1, 1, 0, 0, 0, 0], [2, 1, 1, 0, 0, 0, 0], [3, 1, 1, 0, 0, 0, 0], [4, 1, 1, 0, 0, 0, 0], [5, 1, 1, 0, 0, 0, 0], [6, 1, 1, 0, 0, 0, 0], [7, 1, 1, 0, 0, 0, 0], [8, 1, 1, 0, 0, 0, 0], [9, 1, 1, 0, 0, 0, 0], [10, 1, 1, 0, 0, 0, 0], [11, 1, 1, 0, 0, 0, 0], [12, 1, 1, 0, 0, 0, 0], [13, 1, 1, 0, 0, 0, 0], [14, 1, 1, 0, 0, 0, 0], [15, 1, 1, 0, 0, 0, 0], [16, 1, 1, 0, 0, 0, 0], [17, 1, 1, 0, 0, 0, 0], [18, 1, 1, 0, 0, 0, 0], [19, 1, 1, 0, 0, 0, 0], [20, 1, 1, 0, 0, 0, 0], [21, 1, 1, 0, 0, 0, 0], [22, 1, 1, 0, 0, 0, 0], [23, 1, 4, 90, 0, 1711418927, 0], [24, 1, 1, 0, 0, 0, 0]], [1111, 2, 1, 5, 2], [[1, 1], [2, 1], [3, 1], [4, 1], [5, 0]], [], [], [1, [[0, 1, 1], [1, 2, 0], [2, 3, 0], [3, 4, 0], [4, 5, 0], [5, 6, 0], [6, 7, 0], [7, 8, 800], [8, 9, 2000000]]]]"""
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user