2
0
Эх сурвалжийг харах

[PR #1318] Request tests no longer require JSON parameters to be in order.

# Conflicts:
#	Tests/RequestTests.swift
Marius Serban 9 жил өмнө
parent
commit
b2050ef69b
1 өөрчлөгдсөн 5 нэмэгдсэн , 10 устгасан
  1. 5 10
      Tests/RequestTests.swift

+ 5 - 10
Tests/RequestTests.swift

@@ -588,16 +588,11 @@ class RequestDebugDescriptionTestCase: BaseTestCase {
         XCTAssertEqual(components[0..<3], ["$", "curl", "-i"], "components should be equal")
         XCTAssertEqual(components[3..<5], ["-X", "POST"], "command should contain explicit -X flag")
 
-        XCTAssertTrue(
-            request.debugDescription.range(of: "-H \"Content-Type: application/json\"") != nil,
-            "command should contain 'application/json' Content-Type"
-        )
-
-        let expectedBody = "-d \"{\\\"f'oo\\\":\\\"ba'r\\\",\\\"foo\\\":\\\"bar\\\",\\\"fo\\\\\\\"o\\\":\\\"b\\\\\\\"ar\\\"}\""        
-        XCTAssertTrue(
-            request.debugDescription.range(of: expectedBody) != nil,
-            "command data should contain JSON encoded parameters"
-        )
+        XCTAssertNotNil(request.debugDescription.range(of: "-H \"Content-Type: application/json\""), "command should contain Content-Type header")
+        XCTAssertNotNil(request.debugDescription.range(of: "-d \"{"), "command should contain body parameter")
+        XCTAssertNotNil(request.debugDescription.range(of: "\\\"f'oo\\\":\\\"ba'r\\\""), "command should contain JSON parameters")
+        XCTAssertNotNil(request.debugDescription.range(of: "\\\"fo\\\\\\\"o\\\":\\\"b\\\\\\\"ar\\\""), "command should contain JSON parameters")
+        XCTAssertNotNil(request.debugDescription.range(of: "\\\"foo\\\":\\\"bar\\"), "command should contain JSON parameters")
 
         XCTAssertEqual(components.last ?? "", "\"\(URLString)\"", "URL component should be equal")
     }