     )
 }
 
-private func extractSubscription(_ subscriptionResult: SubscriptionResult) throws -> SubscriptionObservable {
+private func extractSubscriptionFromResult(_ subscriptionResult: SubscriptionResult) throws -> SubscriptionObservable {
     switch subscriptionResult {
     case .success(let subscription):
         return subscription

import RxSwift
@testable import GraphQL


class SubscriptionTests : XCTestCase {
    
    // MARK: Basic test to see if publishing is working
    func testBasic() throws {
        let disposeBag = DisposeBag()
        let pubsub = PublishSubject<Any>()
        let subscription = try createDbAndSubscription(pubsub: pubsub, query: defaultQuery)
        
        let expected = GraphQLResult(
            data: ["importantEmail": [
                "inbox":[
                    "total": 2,
                    "unread": 1
                ],
                "email":[
                    "subject": "Alright",
                    "from": "yuzhi@graphql.org"
                ]
            ]]
        )
        let _ = subscription.subscribe { event in
            let payload = try! event.element!.wait()
            XCTAssertEqual(payload, expected)
        }.disposed(by: disposeBag)
        pubsub.onNext(Email(
            from: "yuzhi@graphql.org",
            subject: "Alright",
            message: "Tests are good",
            unread: true
        ))
    }


    // MARK: Subscription Initialization Phase


    func testAcceptsMultipleSubscriptionFields() throws {
        let disposeBag = DisposeBag()
        let pubsub = PublishSubject<Any>()

        var emails = defaultEmails
        let schema = try GraphQLSchema(
            query: EmailQueryType,
