From fe16dba50a4b85d1e8ef78ba0bc24c99f80deb4c Mon Sep 17 00:00:00 2001 From: denisahearn Date: Fri, 6 Dec 2024 12:40:08 -0600 Subject: [PATCH] Fix tests that broke when generator behavior changed --- .../fixtures/named-root-schema.graphql | 10 -------- test/graphql-docs/generator_test.rb | 24 ++++--------------- 2 files changed, 5 insertions(+), 29 deletions(-) delete mode 100644 test/graphql-docs/fixtures/named-root-schema.graphql diff --git a/test/graphql-docs/fixtures/named-root-schema.graphql b/test/graphql-docs/fixtures/named-root-schema.graphql deleted file mode 100644 index 485af36..0000000 --- a/test/graphql-docs/fixtures/named-root-schema.graphql +++ /dev/null @@ -1,10 +0,0 @@ -schema { - query: RootQuery -} - -type RootQuery { - """ - Do a thing - """ - thing: [String!]! -} diff --git a/test/graphql-docs/generator_test.rb b/test/graphql-docs/generator_test.rb index f42704a..f59ff36 100644 --- a/test/graphql-docs/generator_test.rb +++ b/test/graphql-docs/generator_test.rb @@ -26,10 +26,6 @@ def setup @tiny_parser = GraphQLDocs::Parser.new(tiny_schema, {}) @tiny_results = @tiny_parser.parse - named_root_schema = File.read(File.join(fixtures_dir, 'named-root-schema.graphql')) - @named_root_parser = GraphQLDocs::Parser.new(named_root_schema, {}) - @named_root_results = @named_root_parser.parse - @output_dir = File.join(fixtures_dir, 'output') end @@ -66,6 +62,7 @@ def test_that_it_works assert File.exist? File.join(@output_dir, 'enum', 'issuestate', 'index.html') assert File.exist? File.join(@output_dir, 'input_object', 'projectorder', 'index.html') assert File.exist? File.join(@output_dir, 'interface', 'reactable', 'index.html') + assert File.exist? File.join(@output_dir, 'query', 'codeofconduct', 'index.html') assert File.exist? File.join(@output_dir, 'mutation', 'addcomment', 'index.html') assert File.exist? File.join(@output_dir, 'object', 'repository', 'index.html') assert File.exist? File.join(@output_dir, 'scalar', 'boolean', 'index.html') @@ -136,18 +133,6 @@ def test_that_it_sets_classes assert_match(/
/, object) end - def test_that_named_query_root_generates_fields - options = deep_copy(GraphQLDocs::Configuration::GRAPHQLDOCS_DEFAULTS) - options[:output_dir] = @output_dir - - generator = GraphQLDocs::Generator.new(@named_root_results, options) - generator.generate - - object = File.read File.join(@output_dir, 'operation', 'query', 'index.html') - - assert_match(/Do a thing/, object) - end - def test_that_missing_landing_pages_are_reported options = deep_copy(GraphQLDocs::Configuration::GRAPHQLDOCS_DEFAULTS) options[:landing_pages][:index] = 'BOGUS' @@ -202,9 +187,9 @@ def test_that_empty_html_lines_not_interpreted_by_markdown generator = GraphQLDocs::Generator.new(@tiny_results, options) generator.generate - contents = File.read File.join(@output_dir, 'operation', 'query', 'index.html') + contents = File.read File.join(@output_dir, 'query', 'codeofconduct', 'index.html') - assert_match(%r{\s+

The code of conduct's key

\s+}, contents) + assert_match(%r{

The code of conduct's key

}, contents) end def test_that_non_empty_html_lines_not_interpreted_by_markdown @@ -216,6 +201,7 @@ def test_that_non_empty_html_lines_not_interpreted_by_markdown contents = File.read File.join(@output_dir, 'input_object', 'projectorder', 'index.html') - assert_match %r{
\n

The direction in which to order projects by the specified field.

\s+
}, contents + assert_match %r{
\n

The direction in which to order projects by the specified field.

\s+
}, + contents end end