         }
         """
         
-        let expected = GraphQLResult(data: [
+        let observable = try api.subscribe(
+            request: subscription,
+            context: api.context,
+            on: group
+        ).wait().observable!
+        
+        let expectation = XCTestExpectation()
+        
+        var currentResult = GraphQLResult()
+        let _ = observable.subscribe { event in
+            event.element!.whenSuccess { result in
+                currentResult = result
+                expectation.fulfill()
+            }
+        }.disposed(by: disposeBag)
+
+        pubsub.onNext(User(id: "124", name: "Jerry"))
+
+        wait(for: [expectation], timeout: 10)
+
+        XCTAssertEqual(currentResult, GraphQLResult(data: [
             "subscribeUser": [
                 "user": [
-                    "name": "John Doe",
-                    "id": "123"
+                    "name": "Jerry",
+                    "id": "124"
                 ]
             ]
-        ])
-        
-        let result = try api.subscribe(
-            request: subscription,
-            context: api.context,
-            on: group
-        ).wait()
-        print(result)
-//        let observable = try api.subscribe(
-//            request: subscription,
-//            context: api.context,
-//            on: group
-//        ).wait().observable!
-        
-        let expectation = XCTestExpectation()
-        
-//        var currentResult = GraphQLResult()
-//        let _ = observable.subscribe { event in
-//            event.element!.whenSuccess { result in
-//                currentResult = result
-//                expectation.fulfill()
-//            }
-//        }
-//
-//        pubsub.onNext(User(id: "124", name: "Jerry"))
-//
-//        wait(for: [expectation], timeout: 10)
-//
-//        XCTAssertEqual(currentResult, expected)
+        ]))
     }
 }
 

import RxSwift
@testable import Graphiti

let pubsub = PublishSubject<User>()

struct ID : Codable {
    let id: String

        User(arguments.user)
    }
    
    func subscribeUser(context: HelloContext, arguments: NoArguments) -> Observable<Any> {
        pubsub
    }
}
