@@ -17,6 +17,18 @@ final class SiteSettingMapperTests: XCTestCase {
1717 XCTAssertEqual ( setting. label, " Enable coupons " )
1818 XCTAssertEqual ( setting. value, " yes " )
1919 }
20+
21+ /// Verifies the SiteSetting fields are parsed correctly when response has no data envelope.
22+ ///
23+ func test_SiteSetting_fields_are_properly_parsed_when_response_has_no_data_envelope( ) throws {
24+ let setting = try XCTUnwrap ( mapLoadCouponSettingResponseWithoutDataEnvelope ( ) )
25+ XCTAssertEqual ( setting. siteID, dummySiteID)
26+ XCTAssertEqual ( setting. settingID, " woocommerce_enable_coupons " )
27+ XCTAssertEqual ( setting. settingDescription, " Enable the use of coupon codes " )
28+ XCTAssertEqual ( setting. label, " Enable coupons " )
29+ XCTAssertEqual ( setting. value, " yes " )
30+ }
31+
2032 func test_SiteSetting_value_field_is_properly_parsed_when_value_field_is_not_string( ) throws {
2133 let setting = try XCTUnwrap ( loadMultiselectValueSettingResponse ( ) )
2234 XCTAssertEqual ( setting. settingID, " woocommerce_all_except_countries " )
@@ -41,6 +53,13 @@ private extension SiteSettingMapperTests {
4153 func mapLoadCouponSettingResponse( ) -> SiteSetting ? {
4254 return mapSetting ( from: " setting-coupon " )
4355 }
56+
57+ /// Returns the SiteSettingMapper output upon receiving `setting-coupon-without-data`
58+ ///
59+ func mapLoadCouponSettingResponseWithoutDataEnvelope( ) -> SiteSetting ? {
60+ return mapSetting ( from: " setting-coupon-without-data " )
61+ }
62+
4463 /// Returns the SiteSettingMapper output upon receiving `setting-all-except-countries`
4564 ///
4665 func loadMultiselectValueSettingResponse( ) -> SiteSetting ? {
0 commit comments