emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/graphql adf95c1d92 16/56: Compress output


From: ELPA Syncer
Subject: [elpa] externals/graphql adf95c1d92 16/56: Compress output
Date: Sat, 29 Oct 2022 13:57:53 -0400 (EDT)

branch: externals/graphql
commit adf95c1d920bb94b6bb8c0a5fea506ac20b03f08
Author: Sean Allred <code@seanallred.com>
Commit: Sean Allred <code@seanallred.com>

    Compress output
---
 graphql.el              |  6 +++---
 test/graphql.el-test.el | 23 +++++++++++++----------
 2 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/graphql.el b/graphql.el
index a750f8c025..e57d24c8a9 100644
--- a/graphql.el
+++ b/graphql.el
@@ -82,12 +82,12 @@ parameter."
                                (car last)
                                (cdr last))))
 (defun graphql--encode-parameter (name type &optional required default)
-  (format "$%s: %s%s%s"
+  (format "$%s:%s%s%s"
           (symbol-name name)
           (symbol-name type)
           (if required "!" "")
           (if default
-              (concat " = " (graphql--encode-argument-value default))
+              (concat "=" (graphql--encode-argument-value default))
             "")))
 
 (defun graphql--get-keys (g)
@@ -123,7 +123,7 @@ parameter."
               (format "(%s)"
                       (mapconcat #'graphql--encode-parameter-spec params ",")))
             (when fields
-              (format " { %s }"
+              (format "{%s}"
                       (mapconcat #'graphql-encode fields " ")))))))))
 
 (defun graphql--genform-operation (args kind)
diff --git a/test/graphql.el-test.el b/test/graphql.el-test.el
index 743e86d313..f692c91085 100644
--- a/test/graphql.el-test.el
+++ b/test/graphql.el-test.el
@@ -4,21 +4,21 @@
   (should (string= (graphql-encode
                     '(query
                       hello-world))
-                   "query { hello-world }"))
+                   "query{hello-world}"))
 
   (should (string= (graphql-encode
                     '(query
                       :arguments ((one . 1)
                                   (two . "2"))
                       hello-world))
-                   "query(one:1,two:\"2\") { hello-world }"))
+                   "query(one:1,two:\"2\"){hello-world}"))
 
   (should (string= (graphql-encode
                     '(query
                       :arguments ((one . ($ variableForOne))
                                   (two . "2"))
                       hello-world))
-                   "query(one:$variableForOne,two:\"2\") { hello-world }")))
+                   "query(one:$variableForOne,two:\"2\"){hello-world}")))
 
 (ert-deftest encode-recursive ()
   (should (string= (graphql-encode
@@ -26,7 +26,7 @@
                       (repository
                        :arguments ((owner . "my-owner")
                                    (name . "my-repo-name")))))
-                   "query { 
repository(owner:\"my-owner\",name:\"my-repo-name\") }"))
+                   
"query{repository(owner:\"my-owner\",name:\"my-repo-name\")}"))
 
   (should (string= (graphql-encode
                     '(query
@@ -37,8 +37,8 @@
                         :arguments ((first . 20))
                         (edges (node number title url))))))
                    (concat
-                    "query { 
repository(owner:\"my-owner\",name:\"my-repo-name\") "
-                    "{ issues(first:20) { edges { node { number title url } } 
} } }")))
+                    
"query{repository(owner:\"my-owner\",name:\"my-repo-name\")"
+                    "{issues(first:20){edges{node{number title url}}}}}")))
 
   (should (string= (graphql-encode
                     '(addReaction :arguments ((input . ((subjectId . 
"MDU6SXNzdWUxNzc2MzA3Mjk=")
@@ -46,8 +46,11 @@
                    
"addReaction(input:{subjectId:\"MDU6SXNzdWUxNzc2MzA3Mjk=\",content:HOORAY})")))
 
 (ert-deftest encode-query ()
-  (string= (graphql-query (test ((ep Episode !)
-                                 (review ReviewInput ! . "fifty")))
-                          (repository))
-           "query test($ep: Episode!,$review: ReviewInput! = \"fifty\") { 
repository }"))
+  (should (string= (graphql-query (test)
+                                  (repository))
+                   "query test { repository }"))
+  (should (string= (graphql-query (test ((ep Episode !)
+                                         (review ReviewInput ! . 50)))
+                                  (repository :arguments ((hello . ($ ep)))))
+                   "query test($ep:Episode!,$review:ReviewInput!=50) { 
repository(hello:$ep) }"))  )
 ;;; graphql.el-test.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]