khamusa / rspec-graphql_matchers

Collection of rspec matchers to test your graphQL api schema.
MIT License
145 stars 49 forks source link

Test GraphQL::Schema::Enum #39

Closed emerson-silva-repassa closed 3 years ago

emerson-silva-repassa commented 3 years ago

How to test Enum values? I didn't find anything about it.

khamusa commented 3 years ago

Hey, @emerson-silva-repassa . I didn't find it very meaningful to add helpers for testing enums, but I'd definetly welcome a PR.

We do the following in our project:

RSpec.describe Queries::Question::Order::EnumType do
  it 'enumerizes the correct values' do
    expect(described_class.values.keys)
      .to match_array(%w(CREATED_AT BOOKMARKED ANSWERED_AT LIKES_COUNT))
  end
end

Let me know if I can help you with anything else.