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

[EPIC] Jest integration tests to cover full GraphQL API #5310

Closed
aldeed opened this issue Jul 12, 2019 · 3 comments
Closed

[EPIC] Jest integration tests to cover full GraphQL API #5310

aldeed opened this issue Jul 12, 2019 · 3 comments

Comments

@aldeed
Copy link
Member

@aldeed aldeed commented Jul 12, 2019

Overview

In preparation for a push to remove the Meteor dependency from the GraphQL API, we would like full integration test coverage of all GraphQL queries and mutations provided by all core and included plugins. This epic issue will serve as the central tracking place for the work necessary to write all missing integration tests.

Current State

Mutations That Have Integration Tests

  • addAccountAddressBookEntry
  • addOrderFulfillmentGroup
  • cancelOrderItem
  • moveOrderItems
  • publishProductsToCatalog
  • splitOrderItem
  • updateOrder
  • updateOrderFulfillmentGroup
  • updateSimpleInventory

Mutations That Need Integration Tests

  • Write a full checkout flow integration test #5518
    • createCart (with items)
    • addCartItems (add more items)
    • reconcileCarts (login flow)
    • removeCartItems
    • setEmailOnAnonymousCart
    • setShippingAddressOnCart
    • updateCartItemsQuantity
    • updateFulfillmentOptionsForGroup
    • selectFulfillmentOptionForGroup
    • availablePaymentMethods
    • placeOrder

Queries That Have Integration Tests

  • account
  • administrators
  • catalogItemProduct
  • catalogItems
  • group
  • groups
  • primaryShopId
  • productsByTagId
  • shop
  • simpleInventory
  • tags
  • viewer

Queries That Need Integration Tests

Other tests needed

  • full add to cart and checkout flow - issue #5518

How

If you want to help with this effort:

  1. Pick a mutation or query. Ensure that there isn't already an issue created in this epic for it.
  2. Create an individual GitHub issue to track that one test.
    • Title: "Add Integration Test for [NAME HERE] GraphQL [PICK ONE: mutation/query]"
    • In the description, just link to this issue.
  3. Assign the individual GitHub issue to yourself.
  4. Add the issue to this epic in ZenHub.
  5. Write any tests you think are necessary to fully test all variations of the query or mutation, including permission checks and any other security concerns you have.
  6. Submit a PR that resolves the individual GitHub issue. Edit this description and add a link to your PR right after the query or mutation name in the bullet list.
  7. After your PR is merged to develop, check off that query or mutation in the bullet list in this issue.
@cmbirk

This comment has been minimized.

Copy link
Collaborator

@cmbirk cmbirk commented Aug 27, 2019

@aldeed @focusaurus I'm going to build out some factories in the mocks so we can have larger lists for testing pagination. Is anyone already working on that effort? There are a number of TODOs in the code to build out factories.

@aldeed

This comment has been minimized.

Copy link
Member Author

@aldeed aldeed commented Aug 27, 2019

I answered this outside of GH but putting the answer here for others.

There is a factory package which is used to build mock data in imports/test-utils/helpers/factory.js. You can import Factory from there and then use Factory.CatalogProduct.makeOne or Factory.CatalogProduct.makeMany. There are a few places with examples if you search for those.

Package docs: https://github.com/reactioncommerce/data-factory

We made the data-factory stuff shortly after we wrote all of those giant catalog item mocks and nobody has gone back to rewrite them to use Factory. Help wanted.

This was referenced Oct 31, 2019
@willopez

This comment has been minimized.

Copy link
Member

@willopez willopez commented Feb 3, 2020

All tests in this epic have been implemented!

@willopez willopez closed this Feb 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.