Skip to content

Commit

Permalink
Merge pull request #68 from Shopify/bump-version
Browse files Browse the repository at this point in the history
v5.0.2
  • Loading branch information
felix-d committed Feb 23, 2023
2 parents bd6260c + 5a1b2c4 commit bd5153a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
5.0.2
-----
- [63](https://github.com/Shopify/graphql-metrics/pull/67) Reset `lex` pre-context metrics on `analyze_multiplex`.
5.0.1
-----
- [63](https://github.com/Shopify/graphql-metrics/pull/63) Eliminate `TimedResult` objects for `trace_field`.
Expand Down
2 changes: 1 addition & 1 deletion lib/graphql/metrics/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

module GraphQL
module Metrics
VERSION = "5.0.1"
VERSION = "5.0.2"
end
end
27 changes: 19 additions & 8 deletions test/unit/graphql/metrics/integration_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,15 @@ def self.parse_error(err, _context)

assert_equal_with_diff_on_failure(
[{ directive_name: 'skip' }, { directive_name: 'customDirective' }],
actual_directives
actual_directives,
sort_by: ->(x) { x[:directive_name] }
)

assert_equal_with_diff_on_failure(
expected_arguments,
actual_arguments,
sort_by: ->(x) { x[:argument_name] }
)
assert_equal_with_diff_on_failure(expected_arguments, actual_arguments)
end

test 'extracts metrics from directives on MUTATION location' do
Expand Down Expand Up @@ -312,7 +318,7 @@ def self.parse_error(err, _context)
}
]
assert_equal_with_diff_on_failure([{ directive_name: 'customDirective' }], actual_directives)
assert_equal_with_diff_on_failure(expected_arguments, actual_arguments)
assert_equal_with_diff_on_failure(expected_arguments, actual_arguments, sort_by: ->(x) { x[:argument_name] })
end

test 'extracts metrics from directives on QUERY and FIELD location for document with fragment' do
Expand Down Expand Up @@ -390,9 +396,14 @@ def self.parse_error(err, _context)

assert_equal_with_diff_on_failure(
[{ directive_name: 'skip' }, { directive_name: 'customDirective' }],
actual_directives
actual_directives,
sort_by: -> (x) { x[:directive_name] }
)
assert_equal_with_diff_on_failure(
expected_arguments,
actual_arguments,
sort_by: -> (x) { x[:argument_name] }
)
assert_equal_with_diff_on_failure(expected_arguments, actual_arguments)
end

test 'extracts metrics from queries, as well as their fields and arguments (when using Schema.execute)' do
Expand Down Expand Up @@ -1385,10 +1396,10 @@ class SchemaWithoutTimingMetrics < GraphQL::Schema

private

def assert_equal_with_diff_on_failure(expected, actual)
def assert_equal_with_diff_on_failure(expected, actual, sort_by: ->(_x) {} )
assert_equal(
expected,
actual,
expected.sort_by(&sort_by),
actual.sort_by(&sort_by),
Diffy::Diff.new(JSON.pretty_generate(expected), JSON.pretty_generate(actual))
)
end
Expand Down

0 comments on commit bd5153a

Please sign in to comment.