# frozen_string_literal: true require 'rails_helper' RSpec.describe Types::Admin::<%= class_name %>Type, type: :request do let(:query) do <<-GRAPHQL query all<%= class_name %>s($filter: FinalTestFilter, $page: Int, $perPage: Int, $sortField: String, $sortOrder: String) { all<%= class_name %>s(filter: $filter, page: $page, perPage: $perPage, sortField: $sortField, sortOrder: $sortOrder){ id } } GRAPHQL end let(:admin_user) { create :admin_user } describe '#resolve' do it 'pass' do variables = <<~GQL { "filter": , "page": , "perPage": , "sortField": , "sortOrder": } GQL post '/api/admin/graphql', headers: admin_user.create_new_auth_token, params: { query: query, variables: variables } expect(response).to have_http_status(:success) json = JSON.parse(response.body) expect(json['data']['all'<%= class_name %>'s']['filter']).to eq expect(json['data']['all'<%= class_name %>'s']['page']).to eq expect(json['data']['all'<%= class_name %>'s']['perPage']).to eq expect(json['data']['all'<%= class_name %>'s']['sortField']).to eq expect(json['data']['all'<%= class_name %>'s']['sortOrder']).to eq end end end