Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/add tests for compile time default value evaluation #1026

Merged
merged 5 commits into from
Jan 11, 2021
Merged

Fix/add tests for compile time default value evaluation #1026

merged 5 commits into from
Jan 11, 2021

Conversation

dylan-chong
Copy link
Contributor

No description provided.

@@ -169,7 +169,6 @@ defmodule Absinthe.Blueprint.Schema do
end

defp build_types([:close | rest], [%Schema.InputValueDefinition{} = arg, field | stack], buff) do
arg = Map.update!(arg, :default_value, fn val -> {:unquote, [], [val]} end)
Copy link
Contributor Author

@dylan-chong dylan-chong Jan 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seemed to not work, and i'm guess it was supposed to do the evaluation. Clearly it didn't so just removed and used the wrap_in_unquote function. Tests are passing anyway


assert type.fields[unquote(test_label)].default_value == unquote(expected_value)
end
end)
Copy link
Contributor Author

@dylan-chong dylan-chong Jan 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the input object's field's default_value is always nil here. Not sure if intentional or not. But i have removed this test in ffb7a0c for the time being

@dylan-chong
Copy link
Contributor Author

dylan-chong commented Jan 7, 2021

@binaryseed Would this be able to make it into 1.6? I found this issue testing 1.6.0-rc-0 on my company's codebase

@@ -1,68 +1,51 @@
defmodule Absinthe.Type.QueryTest do
use Absinthe.Case, async: true

defmodule TestSchema do
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved to fixtures

@binaryseed
Copy link
Contributor

Thanks for this!

@binaryseed binaryseed merged commit 4154c91 into absinthe-graphql:master Jan 11, 2021
@dylan-chong dylan-chong deleted the fix/add-tests-for-compile-time-default_value-evaluation branch January 11, 2021 22:18
@dylan-chong dylan-chong restored the fix/add-tests-for-compile-time-default_value-evaluation branch January 11, 2021 22:18
@dylan-chong dylan-chong deleted the fix/add-tests-for-compile-time-default_value-evaluation branch January 12, 2021 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants