Skip to content

How to resolve generated mock arguments when names clash? #3519

Closed
@drekka

Description

@drekka

Question

I'm trying to figure out an issue with a unit test in Swift where I need to generate a mock response. I've been looking at the generated Query type which has a huge list of initializer arguments sourced from all the available queries in the *.grapql files.

The problem I've encountered in that there are two queries which have the same names in them, but different types. So something like this:

query A {
  someThing: TypeA {
  }
}


query B {
  someThing: TypeB {
  }
}

This generates a Query initializer that looks like this:

public extension Mock where O == Query {
  convenience init(
    someThing: Mock< TypeB >? = nil
) {  }

Which is a problem because I cannot use this initializer with a TypeA argument.

My question is how do I resolve this? Should these names be unique across the entire set of queries? or is there some other way to set things up?

Metadata

Metadata

Assignees

No one assigned

    Labels

    awaiting responsequestionIssues that have a question which should be addressed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions