Sha256: 6aa3e0046d020d84605ae308274c5349e45c8e21d071881f45085ff6c0120364

Contents?: true

Size: 1 KB

Versions: 5

Compression:

Stored size: 1 KB

Contents

# frozen_string_literal: true

require 'test_plugin_helper'

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

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

      setup do
        FactoryBot.create(:webhook_template)
      end

      test 'fetching webhook templates attributes' do
        assert_empty result['errors']

        expected_count = ::WebhookTemplate.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/webhook_templates_query_test.rb
foreman_webhooks-3.2.3 test/graphql/foreman_webhooks/queries/webhook_templates_query_test.rb
foreman_webhooks-3.2.2 test/graphql/foreman_webhooks/queries/webhook_templates_query_test.rb
foreman_webhooks-3.2.1 test/graphql/foreman_webhooks/queries/webhook_templates_query_test.rb
foreman_webhooks-3.2.0 test/graphql/foreman_webhooks/queries/webhook_templates_query_test.rb