X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=t%2Fcli.t;h=a32af83b333f6189b694c70185f0d36b0e2a0cc6;hb=26b24f42605c8646a9c21ef2b94f1ceeec6cf634;hp=2ae980e4f0a76e55785ba01d8da9fd56ff1bd404;hpb=4df3f6c276a2ee1d697d2199e186c187436333d8;p=chaz%2Fgraphql-client diff --git a/t/cli.t b/t/cli.t index 2ae980e..a32af83 100755 --- a/t/cli.t +++ b/t/cli.t @@ -8,9 +8,12 @@ use Test::More; use GraphQL::Client::CLI; +delete $ENV{GRAPHQL_CLIENT_OPTIONS}; + subtest 'get_options' => sub { my $expected = { format => 'json:pretty', + filter => undef, help => undef, manual => undef, operation_name => undef, @@ -31,6 +34,14 @@ subtest 'get_options' => sub { $r = GraphQL::Client::CLI->_get_options(qw{foo bar}); is_deeply($r, $expected, '--query is also optional') or diag explain $r; + + { + local $ENV{GRAPHQL_CLIENT_OPTIONS} = '--url asdf --query "baz qux" --unpack'; + local $expected->{query} = 'baz qux'; + local $expected->{unpack} = 1; + $r = GraphQL::Client::CLI->_get_options(qw{--url foo}); + is_deeply($r, $expected, 'options can come from GRAPHQL_CLIENT_OPTIONS') or diag explain $r; + } }; subtest 'expand_vars' => sub {