Sha256: b52e25251ff6b0c6e69875ebde59d475cf8ee12e896b672bc62d57bfd8a76562

Contents?: true

Size: 976 Bytes

Versions: 5

Compression:

Stored size: 976 Bytes

Contents

# frozen_string_literal: true

require 'test_plugin_helper'

module ForemanWebhooks
  module Queries
    class WebhooksQueryTest < GraphQLQueryTestCase
      let(:query) do
        <<-GRAPHQL
        query {
          webhooks {
            totalCount
            pageInfo {
              startCursor
              endCursor
              hasNextPage
              hasPreviousPage
            }
            edges {
              cursor
              node {
                id
              }
            }
          }
        }
        GRAPHQL
      end

      let(:data) { result['data']['webhooks'] }

      setup do
        FactoryBot.create(:webhook)
      end

      test 'fetching webhooks attributes' do
        assert_empty result['errors']

        expected_count = ::Webhook.count

        assert_not_equal 0, expected_count
        assert_equal expected_count, data['totalCount']
        assert_equal expected_count, data['edges'].count
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
foreman_webhooks-4.0.0 test/graphql/foreman_webhooks/queries/webhooks_query_test.rb
foreman_webhooks-3.2.3 test/graphql/foreman_webhooks/queries/webhooks_query_test.rb
foreman_webhooks-3.2.2 test/graphql/foreman_webhooks/queries/webhooks_query_test.rb
foreman_webhooks-3.2.1 test/graphql/foreman_webhooks/queries/webhooks_query_test.rb
foreman_webhooks-3.2.0 test/graphql/foreman_webhooks/queries/webhooks_query_test.rb