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

simplify tests with transformRelayClientPayload() #341

Closed

Conversation

josephsavona
Copy link
Contributor

A lot of our tests have to write data into the store before testing some other logic. However, the payloads must be manually constructed using generateRQLFieldAlias(). It's not a big deal, but it's annoying.

So this PR adds a new module transformClientPayload(query: RelayQuery.Node, payload: Payload): Payload - it accepts payloads where the keys correspond to field names/aliases (which cannot be written into the store as-is), and returns an equivalent payload where keys are renamed to the serialization key of the corresponding field (which can be written to the store). See the unit test for this module for an example, and how it (slightly) simplifies tests that write to the store.

I didn't convert all tests - I wanted to get feedback first.

@josephsavona
Copy link
Contributor Author

cc @wincent who had talked about doing something like this a while back.

@josephsavona
Copy link
Contributor Author

@facebook-github-bot import

@facebook-github-bot
Copy link
Contributor

Thanks for importing. If you are an FB employee go to https://our.intern.facebook.com/intern/opensource/github/pull_request/140817766264897/int_phab to review.

@wincent
Copy link
Contributor

wincent commented Sep 18, 2015

Excellent! Haven't actually looked at the code yet, but I love the idea of this.

@josephsavona josephsavona force-pushed the transform-client-payload branch 4 times, most recently from f4e0aca to 1209ead Compare September 18, 2015 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants