Skip to content
This repository has been archived by the owner on Apr 4, 2022. It is now read-only.

Fake GraphQL requests with HTTP client #12

Open
driesvints opened this issue Aug 21, 2021 · 1 comment
Open

Fake GraphQL requests with HTTP client #12

driesvints opened this issue Aug 21, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@driesvints
Copy link
Owner

To speed things up we should fake the GraphQL requests. This will also be necessary to allow pull requests from GitHub since those won't be authenticated with a token and thus all PR's will fail.

We should also keep a portion of an integration test suite with a real token but those tests can be skipped if no token is set on the environment.

@driesvints driesvints added the enhancement New feature or request label Aug 21, 2021
@claudiodekker
Copy link

Posting for relevance / use-for-parts (copied from my WIP inertiajs implementation):

Http::fake([
    'https://api.github.com/graphql' => Http::response([
        'data' => [
            'user' => [
                'viewerIsSponsoring' => false,
            ],
            'organization' => null,
        ],
        'errors' => [
            [
                'type' => 'NOT_FOUND',
                'path' => [
                    'organization',
                ],
                'locations' => [
                    'line' => 5,
                    'column' => 3,
                ],
                'message' => "Could not resolve to an Organization with the login of 'reinink'.",
            ],
        ],
    ]),
]);

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants