]> Dogcows Code - chaz/graphql-client/commitdiff
test GRAPHQL_CLIENT_OPTIONS
authorCharles McGarvey <chazmcgarvey@brokenzipper.com>
Sun, 22 Mar 2020 08:53:45 +0000 (02:53 -0600)
committerCharles McGarvey <chazmcgarvey@brokenzipper.com>
Sun, 22 Mar 2020 08:53:45 +0000 (02:53 -0600)
t/cli.t

diff --git a/t/cli.t b/t/cli.t
index 2ae980e4f0a76e55785ba01d8da9fd56ff1bd404..2fa501ceac917a4f2dc88bac39e0d127ea579208 100755 (executable)
--- a/t/cli.t
+++ b/t/cli.t
@@ -8,6 +8,8 @@ use Test::More;
 
 use GraphQL::Client::CLI;
 
+delete $ENV{GRAPHQL_CLIENT_OPTIONS};
+
 subtest 'get_options' => sub {
     my $expected = {
         format          => 'json:pretty',
@@ -31,6 +33,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 {
This page took 0.022551 seconds and 4 git commands to generate.