                 notImportantEmail
             }
         """)
-        
+
         let _ = subscription.subscribe{ event in
             let _ = try! event.element!.wait()
         }.disposed(by: disposeBag)

    func testAcceptsMultipleSubscriptionFields() throws {
        let disposeBag = DisposeBag()
        let pubsub = PublishSubject<Any>()
        
        var emails = defaultEmails
        let schema = try GraphQLSchema(
            query: EmailQueryType,


/// Generates a default schema and email database, and returns the subscription
private func createDbAndSubscription(
    pubsub:PublishSubject<Any>,
    query:String,
    variableValues: [String: Map] = [:]
) throws -> SubscriptionObservable {
    var emails = defaultEmails
    let observer = pubsub.do(
        onNext: { emailAny in
            let email = emailAny as! Email
            emails.append(email)
        }
    )
    
    let schema = emailSchemaWithResolvers(
        resolve: {emailAny, _, _, eventLoopGroup, _ throws -> EventLoopFuture<Any?> in
            let email = emailAny as! Email
            return eventLoopGroup.next().makeSucceededFuture(EmailEvent(
                email: email,
                inbox: Inbox(emails: emails)
            ))
        },
        subscribe: {_, _, _, eventLoopGroup, _ throws -> EventLoopFuture<Any?> in
            return eventLoopGroup.next().makeSucceededFuture(observer)
        }
    )
    
    return try createSubscription(pubsub: pubsub, schema: schema, query: query, variableValues: variableValues)
}

/// Generates a subscription from the given schema and query. It's expected that the database is managed by the caller.
private func createSubscription(
    pubsub: Observable<Any>,
    schema: GraphQLSchema,
    query: String,
    variableValues: [String: Map] = [:]
) throws -> SubscriptionObservable {
    let document = try parse(source: query)
    let subscriptionOrError = try subscribe(
        queryStrategy: SerialFieldExecutionStrategy(),
        mutationStrategy: SerialFieldExecutionStrategy(),
