Skip to content
This repository was archived by the owner on Sep 15, 2025. It is now read-only.

Commit 7783695

Browse files
committed
Simplified unit tests as suggested via PR feedback
1 parent 5aea34e commit 7783695

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

WordPressKitTests/SiteVerticalsRequestEncodingTests.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ final class SiteVerticalsRequestEncodingTests: XCTestCase {
1919
XCTAssertNoThrow(try JSONSerialization.jsonObject(with: encodedJSON, options: []))
2020
let serializedJSON = try! JSONSerialization.jsonObject(with: encodedJSON, options: [])
2121

22-
if let _ = serializedJSON as? [String : AnyObject] {} else {
22+
guard let jsonDictionary = serializedJSON as? [String : AnyObject] else {
2323
XCTFail("Failed to encode a proper JSON dictionary!")
24+
return
2425
}
25-
let jsonDictionary = serializedJSON as! [String : AnyObject]
2626

2727
// Then
2828
let actualSearch = jsonDictionary["search"] as? String
@@ -50,10 +50,10 @@ final class SiteVerticalsRequestEncodingTests: XCTestCase {
5050
XCTAssertNoThrow(try JSONSerialization.jsonObject(with: encodedJSON, options: []))
5151
let serializedJSON = try! JSONSerialization.jsonObject(with: encodedJSON, options: [])
5252

53-
if let _ = serializedJSON as? [String : AnyObject] {} else {
53+
guard let jsonDictionary = serializedJSON as? [String : AnyObject] else {
5454
XCTFail("Failed to encode a proper JSON dictionary!")
55+
return
5556
}
56-
let jsonDictionary = serializedJSON as! [String : AnyObject]
5757

5858
// Then
5959
let actualSearch = jsonDictionary["search"] as? String
@@ -81,10 +81,10 @@ final class SiteVerticalsRequestEncodingTests: XCTestCase {
8181
XCTAssertNoThrow(try JSONSerialization.jsonObject(with: encodedJSON, options: []))
8282
let serializedJSON = try! JSONSerialization.jsonObject(with: encodedJSON, options: [])
8383

84-
if let _ = serializedJSON as? [String : AnyObject] {} else {
84+
guard let jsonDictionary = serializedJSON as? [String : AnyObject] else {
8585
XCTFail("Failed to encode a proper JSON dictionary!")
86+
return
8687
}
87-
let jsonDictionary = serializedJSON as! [String : AnyObject]
8888

8989
// Then
9090
let actualSearch = jsonDictionary["search"] as? String

WordPressKitTests/SiteVerticalsResponseDecodingTests.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ final class SiteVerticalDecodingTests: XCTestCase {
120120
// MARK: Multiple Verticals
121121

122122
func testSiteParsingOfMultipleVerticalsWorksAsExpected() {
123-
XCTAssertTrue(!verticalsSUT.isEmpty)
124123
XCTAssertEqual(verticalsSUT.count, 5)
125124
}
126125

0 commit comments

Comments
 (0)