File tree Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -387,7 +387,7 @@ extension BlockEditorSettingsServiceTests {
387387 service. fetchSettings { _ in
388388 waitExpectation. fulfill ( )
389389 }
390- waitForExpectations ( timeout: expectationTimeout)
390+ wait ( for : [ waitExpectation ] , timeout: expectationTimeout)
391391 HTTPStubs . removeStub ( descriptor)
392392 }
393393}
Original file line number Diff line number Diff line change @@ -86,19 +86,22 @@ final class CommentService_RepliesTests: CoreDataTestCase {
8686 }
8787
8888 func test_getReplies_addsCommentIdInParameter( ) {
89- let ( mockService, mockApi) = makeMockService ( )
89+ var request : URLRequest ?
90+ stub ( condition: { $0. url? . absoluteString. contains ( " /wp/v2/sites/ \( self . siteID) /comments " ) == true } ) {
91+ request = $0
92+ return HTTPStubsResponse ( error: URLError ( . networkConnectionLost) )
93+ }
94+
9095 let parentKey = CommentServiceRemoteREST . RequestKeys. parent. rawValue
9196
92- mockService . getLatestReplyID ( for: commentID,
97+ self . commentService . getLatestReplyID ( for: commentID,
9398 siteID: siteID,
9499 accountService: accountService,
95100 success: { _ in } ,
96101 failure: { _ in } )
97102
98- var parameters = [ String: Any] ( )
99- expect ( mockApi. parametersPassedIn) . toNot ( beNil ( ) )
100- expect { parameters = mockApi. parametersPassedIn! as! [ String : Any ] } . toNot ( throwError ( ) )
101- expect ( parameters [ parentKey] as? Int ) . to ( equal ( commentID) )
103+ expect ( request) . toNotEventually ( beNil ( ) )
104+ expect ( request? . url? . query) . to ( contain ( " parent= \( commentID) " ) )
102105 }
103106
104107 func test_replyToPost_givenSuccessfulAPICall_insertsNewComment( ) throws {
You can’t perform that action at this time.
0 commit comments