From 9522f70bd948866ef9de043a4b9ed10a3a32aee1 Mon Sep 17 00:00:00 2001 From: Yury Lebedev Date: Mon, 9 Sep 2024 13:29:24 +0200 Subject: [PATCH] Add specs for graphql integration .ast_node_classes_defined? --- .../appsec/contrib/graphql/integration_spec.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 spec/datadog/appsec/contrib/graphql/integration_spec.rb diff --git a/spec/datadog/appsec/contrib/graphql/integration_spec.rb b/spec/datadog/appsec/contrib/graphql/integration_spec.rb new file mode 100644 index 00000000000..99f1d44b568 --- /dev/null +++ b/spec/datadog/appsec/contrib/graphql/integration_spec.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +require 'datadog/appsec/spec_helper' +require 'datadog/appsec/contrib/graphql/integration' + +RSpec.describe Datadog::AppSec::Contrib::GraphQL::Integration do + describe '.ast_node_classes_defined?' do + it 'returns true when all AST node classes are defined' do + expect(described_class.ast_node_classes_defined?).to eq(true) + end + + it 'returns false when at least one of AST node classes is not defined' do + hide_const('GraphQL::Language::Nodes::Field') + expect(described_class.ast_node_classes_defined?).to eq(false) + end + end +end