        let task = networkService.search(query: "h") { (data, error) in
            // Make sure we downloaded some data.
            XCTAssertNotNil(data, "No data was downloaded. \(error!)")

            // Fulfill the expectation to indicate that the background task has finished successfully.
            expectation.fulfill()
        }

        XCTAssertNotNil(task, "task should not be nil")

        wait(for: [expectation], timeout: 4.0)