Shopify / shopify-app-js

MIT License
294 stars 116 forks source link

[bugfix] Ensure consistent behaviour when using access token from session in GQL and REST clients #1772

Open sle-c opened 3 days ago

sle-c commented 3 days ago

WHY are these changes introduced?

Fixes https://github.com/Shopify/shopify-app-js/issues/1756

Passing real session to REST and GQL clients result in inconsistent behaviour. This is due to a custom if condition in the REST client that the GQL client doesn't have.

This only happens when using the testConfig test helper. While the consistent behaviour between the two is highly encouraged. It's not recommended to use a real session when using a testConfig. It's supposed to be a quick helper for unit tests, so all requests should be mocked.

For e2e tests, use a real config that points to a test Shopify store.

WHAT is this pull request doing?

This pull request includes changes to make the GraphQL (GQL) client behavior on custom app configurations consistent with the REST client. The most important changes include adding tests to ensure the correct behavior and updating the client classes to handle custom store app access tokens appropriately.

Consistent Behavior for Custom App Configurations:

Test Enhancements:

Client Class Updates:

Type of change

Checklist