Last active
July 18, 2024 15:00
-
-
Save aarona/17aad4b6269208260da2f2d82dd23937 to your computer and use it in GitHub Desktop.
Crucial RSpec test to include when running GraphQL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RSpec.describe GraphQL::Schema::Printer do | |
describe '#print_schema' do | |
it 'should not raise an error when called' do | |
expect { GraphQL::Schema::Printer.print_schema(MyAppSchema) }.to_not raise_error | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
GraphQL can be really finicky. For example given the following code:
Will allow you to create passing specs that test against both of these mutations but according to GraphQL Schema, this is invalid because there are two classes named
SomeMuation
. It doesn't matter that they're in separate modules.Including the above test in your test suite will catch errors like this despite individually your tests are passing.