@@ -2,13 +2,13 @@ import XCTest
22@testable import WordPressKit
33
44final class RemoteConfigRemoteTests : RemoteTestCase , RESTTestable {
5-
5+
66 // MARK: Variables
7-
7+
88 private let endpoint = " /wpcom/v2/mobile/remote-config "
9-
9+
1010 // MARK: Tests
11-
11+
1212 func testThatResponsesAreHandledCorrectly( ) throws {
1313 // Given
1414 let dictionary = [ " key1 " : " value " , " key2 " : " value2 " ]
@@ -18,7 +18,7 @@ final class RemoteConfigRemoteTests: RemoteTestCase, RESTTestable {
1818 // When
1919 let expectation = XCTestExpectation ( )
2020 RemoteConfigRemote ( wordPressComRestApi: getRestApi ( ) ) . getRemoteConfig { result in
21-
21+
2222 // Then
2323 let response = try ! result. get ( ) as? [ String : String ]
2424 XCTAssertEqual ( response, dictionary)
@@ -27,7 +27,7 @@ final class RemoteConfigRemoteTests: RemoteTestCase, RESTTestable {
2727
2828 wait ( for: [ expectation] , timeout: 1 )
2929 }
30-
30+
3131 func testThatEmptyResponsesAreHandledCorrectly( ) throws {
3232 // Given
3333 let emptyDictionary : [ String : String ] = [ : ]
@@ -37,15 +37,15 @@ final class RemoteConfigRemoteTests: RemoteTestCase, RESTTestable {
3737 // When
3838 let expectation = XCTestExpectation ( )
3939 RemoteConfigRemote ( wordPressComRestApi: getRestApi ( ) ) . getRemoteConfig { result in
40-
40+
4141 // Then
4242 XCTAssertEqual ( 0 , try ! result. get ( ) . count)
4343 expectation. fulfill ( )
4444 }
4545
4646 wait ( for: [ expectation] , timeout: 1 )
4747 }
48-
48+
4949 func testThatMalformedResponsesReturnEmptyArray( ) throws {
5050 // Given
5151 let data = try toJSON ( object: [ " Invalid " ] )
@@ -54,7 +54,7 @@ final class RemoteConfigRemoteTests: RemoteTestCase, RESTTestable {
5454 // When
5555 let expectation = XCTestExpectation ( )
5656 RemoteConfigRemote ( wordPressComRestApi: getRestApi ( ) ) . getRemoteConfig { result in
57-
57+
5858 // Then
5959 switch result {
6060 case . success: XCTFail ( )
@@ -72,19 +72,19 @@ final class RemoteConfigRemoteTests: RemoteTestCase, RESTTestable {
7272 // When
7373 let expectation = XCTestExpectation ( )
7474 RemoteConfigRemote ( wordPressComRestApi: getRestApi ( ) ) . getRemoteConfig { result in
75-
75+
7676 // Then
7777 if case . success = result {
7878 XCTFail ( )
7979 }
8080 expectation. fulfill ( )
8181 }
82-
82+
8383 wait ( for: [ expectation] , timeout: 1 )
8484 }
85-
85+
8686 // MARK: Helpers
87-
87+
8888 private func toJSON< T: Codable > ( object: T ) throws -> Data {
8989 let encoder = JSONEncoder ( )
9090 encoder. outputFormatting = [ . sortedKeys, . prettyPrinted]
0 commit comments