Skip to content
Discussion options

You must be logged in to vote

Ok, cool to know you're using Dataloader, not GraphQL-Batch. That makes it simpler because we don't have to worry about whether these methods return Promises or not. For unit testing, you can wrap the code with GraphQL::Dataloader.with_dataloading { ... } (doc) to create a batch-loading context.

I think the first thing I would try is to generate Resolver classes that could be tested apart from GraphQL queries. Here's a take on that:

Generate Resolver classes based on scope, resolves_to, and filters

class FilteredRelationResolver < GraphQL::Schema::Resolver # or your app's base resolver if relevant
  class << self
    # Class-level configuration, assigned with `.generate`
    attr_accessor 

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
3 replies
@mroach
Comment options

@rmosolgo
Comment options

@mroach
Comment options

Comment options

You must be logged in to vote
3 replies
@mroach
Comment options

@rmosolgo
Comment options

Answer selected by mroach
@mroach
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants