Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add relay mocking to storybook router #1065

Merged
merged 1 commit into from
Jul 30, 2018
Merged

Add relay mocking to storybook router #1065

merged 1 commit into from
Jul 30, 2018

Conversation

zephraph
Copy link
Contributor

This adds the ability to mock up a Relay response in the StorybookRouter (and in other places) to be able to get responses without needed to rely on metaphysics staging.

@artsyit
Copy link
Contributor

artsyit commented Jul 30, 2018

Deploy preview for artsy-reaction ready!

Built with commit a81d58f

https://deploy-preview-1065--artsy-reaction.netlify.com

Query: () => ({
me: {
name: "Alice Jane",
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice and simple

@alloy
Copy link
Contributor

alloy commented Jul 30, 2018

Off topic: when pairing you should consider using git’s signed-off-by feature. I think @xtina-starr and @yuki24 even use a convenient tool for that.

@damassi
Copy link
Member

damassi commented Jul 30, 2018

I believe this is the tool they use: https://github.com/git-duet/git-duet

<StorybooksRouter
routes={orderRoutes}
initialRoute="/order2/123/shipping"
mockResolvers={{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a follow up PR I think the API for this can be cleaned up to just

<StorybooksRouter
  routes={ ... }
  route={ ... } 
  resolvers={ ... } 
  state={ ... } 
/>

Right now it seems like the initial and mock prefixes add unnecessary noise.

@@ -0,0 +1,13 @@
import { IResolvers } from "graphql-tools/dist/Interfaces"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting -- I wonder if the I<Name> idiom is coming back 🤔

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nooooooooooooooooo

(it's actually the default in tslint, we always turn it off)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, please no; we’re not 🤖s but 👩‍🎨 & 👨‍🎨!

@damassi
Copy link
Member

damassi commented Jul 30, 2018

LGTM 👍

I'm excited that we now have a solid testing path, too, though I think we might want to rename StorybooksRouter once we start testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants