zammad_schema_max_depth_spec.rb 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. # Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe Gql::ZammadSchema, type: :graphql do
  4. context 'when making queries that are too complex', authenticated_as: :agent do
  5. let(:agent) { create(:agent, department: 'TestDepartment') }
  6. let(:query) do
  7. <<~QUERY
  8. query currentUser {
  9. currentUser {
  10. organization {
  11. members(first: 40) {
  12. edges {
  13. node {
  14. firstname
  15. organization {
  16. members(first: 40) {
  17. edges {
  18. node {
  19. firstname
  20. organization {
  21. name
  22. }
  23. }
  24. }
  25. }
  26. }
  27. }
  28. }
  29. }
  30. }
  31. }
  32. }
  33. QUERY
  34. end
  35. before do
  36. gql.execute(query)
  37. end
  38. it 'has data' do
  39. expect(gql.result.error_message).to eq('Query has depth of 11, which exceeds max depth of 10')
  40. end
  41. end
  42. end