Skip to content

Commit 2339451

Browse files
committed
💡 update test comments for clarity and organization
1 parent c1686bc commit 2339451

File tree

1 file changed

+4
-42
lines changed

1 file changed

+4
-42
lines changed

qs-kotlin/src/test/kotlin/io/github/techouse/qskotlin/unit/QsParserSpec.kt

Lines changed: 4 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import java.nio.charset.StandardCharsets
1212

1313
class QsParserSpec :
1414
DescribeSpec({
15-
/// Ported from https://github.com/atek-software/qsparser/blob/main/src/test/java/ro/atek/qsparser/QueryStringParserTest.java
15+
/// Ported from
16+
// https://github.com/atek-software/qsparser/blob/main/src/test/java/ro/atek/qsparser/QueryStringParserTest.java
1617
describe("parsing") {
1718
it("should parse a simple string") {
1819
val options = DecodeOptions()
@@ -677,7 +678,8 @@ class QsParserSpec :
677678
}
678679
}
679680

680-
/// Ported from https://github.com/atek-software/qsparser/blob/main/src/test/java/ro/atek/qsparser/QueryStringBuilderTest.java
681+
/// Ported from
682+
// https://github.com/atek-software/qsparser/blob/main/src/test/java/ro/atek/qsparser/QueryStringBuilderTest.java
681683
describe("encoding") {
682684
it("should stringify a querystring object") {
683685
encode(mapOf("a" to "b")) shouldBe "a=b"
@@ -967,44 +969,4 @@ class QsParserSpec :
967969
commaResult shouldContain "a="
968970
}
969971
}
970-
971-
/// Ported from https://github.com/atek-software/qsparser/blob/main/src/test/java/ro/atek/qsparser/UtilsTest.java
972-
describe("merge functionality via decode") {
973-
it("should handle null values in arrays") {
974-
val options = DecodeOptions(strictNullHandling = true)
975-
976-
// Test array with null values
977-
decode("a[0]=42&a[1]", options) shouldBe mapOf("a" to listOf("42", null))
978-
decode("a[]=42&a[]", options) shouldBe mapOf("a" to listOf("42", null))
979-
}
980-
981-
it("should merge duplicate keys correctly") {
982-
val options = DecodeOptions()
983-
984-
// Test merging same keys
985-
decode("a=b&a=c", options) shouldBe mapOf("a" to listOf("b", "c"))
986-
987-
// Test merging arrays
988-
decode("foo[]=bar&foo[]=baz", options) shouldBe mapOf("foo" to listOf("bar", "baz"))
989-
decode("foo[0]=bar&foo[1]=baz", options) shouldBe
990-
mapOf("foo" to listOf("bar", "baz"))
991-
992-
// Test complex nested structures
993-
decode("foo[0]=bar&foo[1][first]=123&foo[second]=456", options) shouldBe
994-
mapOf(
995-
"foo" to mapOf(0 to "bar", 1 to mapOf("first" to "123"), "second" to "456")
996-
)
997-
}
998-
999-
it("should handle mixed array and object merging") {
1000-
val options = DecodeOptions()
1001-
1002-
// Test merging arrays with different lengths
1003-
decode("a[]=baz&a[]=bar&a[]=xyzz", options) shouldBe
1004-
mapOf("a" to listOf("baz", "bar", "xyzz"))
1005-
1006-
// Test adding properties to existing structure
1007-
decode("foo=baz&bar", options) shouldBe mapOf("foo" to "baz", "bar" to true)
1008-
}
1009-
}
1010972
})

0 commit comments

Comments
 (0)