Hello all! I have been updating a project to use A...
# apollo-kotlin
j
Hello all! I have been updating a project to use Apollo and really liking it so far. I have a few questions about the test builders which are available in v3: 1. Is there an eta on when test builders will be out of experimental? 2. Do I always need to start from Query.Data when using test builders? In the example usage provided, it looks like you have to start with
HeroForEpisodeQuery.Data
, but it would be nice to be able to reference
hero
directly, especially in cases where we have more nested models. 3. Related to the previous question, how do I mock fields which are lists if I want to set some values of the list items but not all? Would I need to use real models?
m
1. no ETA at the moment. Depends the amount of feedback we have. 2. Good Point. You could copy/paste the logic from
Data
and adapt it for another Builder (like
HeroBuilder
for an example). But that doesn't feel very natural. Do you want to open an issue about this so we can investigate better APIs? 3. You can fake lists using
listOf
(an example is here) :
Copy code
val data = AllPlanetsQuery.Data {
      allPlanets = allPlanets {
        planets = listOf(
            planet {
              name = "Tatoine"
            }
        )
      }
    }
🙏 1
j
Thanks, appreciate the response! I'll open an issue regarding the second point
👍 1