Skip to content

Commit a7b8c3c

Browse files
committed
Update test for SiteAPIMapper
1 parent 0841d44 commit a7b8c3c

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Networking/NetworkingTests/Mapper/SiteAPIMapperTests.swift

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,18 @@ class SiteAPIMapperTests: XCTestCase {
3030
XCTAssertEqual(apiSettings?.highestWooVersion, WooAPIVersion.mark3)
3131
}
3232

33+
/// Verifies the SiteSetting fields are parsed correctly.
34+
///
35+
func test_SiteSetting_fields_are_properly_parsed_when_response_has_no_data_envelope() {
36+
let apiSettings = mapLoadSiteAPIResponseWithoutDataEnvelope()
37+
38+
XCTAssertNotNil(apiSettings)
39+
XCTAssertEqual(apiSettings?.siteID, dummySiteID)
40+
XCTAssertNotNil(apiSettings?.namespaces)
41+
XCTAssertEqual(apiSettings?.namespaces, dummyNamespaces)
42+
XCTAssertEqual(apiSettings?.highestWooVersion, WooAPIVersion.mark3)
43+
}
44+
3345
/// Verifies the SiteSetting fields are parsed correctly.
3446
///
3547
func test_broken_SiteSetting_fields_are_properly_parsed() {
@@ -64,6 +76,12 @@ private extension SiteAPIMapperTests {
6476
return mapSiteAPIData(from: "site-api")
6577
}
6678

79+
/// Returns the SiteAPIMapper output upon receiving `site-api-without-data`
80+
///
81+
func mapLoadSiteAPIResponseWithoutDataEnvelope() -> SiteAPI? {
82+
return mapSiteAPIData(from: "site-api-without-data")
83+
}
84+
6785
/// Returns the SiteAPIMapper output upon receiving `site-api`
6886
///
6987
func mapLoadBrokenSiteAPIResponse() -> SiteAPI? {

0 commit comments

Comments
 (0)