about summary refs log tree commit diff
path: root/tests/javascript.scm
diff options
context:
space:
mode:
authorArun Isaac2025-12-17 15:02:37 +0000
committerArun Isaac2025-12-17 15:02:37 +0000
commitd7a92a2976874cbb9584d943e88e8ccdfd810d53 (patch)
tree6bc8fb8095b6db4c30803c32a307cfe1229cf8d2 /tests/javascript.scm
parent0182f68ba1ce786ef2f6e91502b4684f913f97dd (diff)
downloadravanan-d7a92a2976874cbb9584d943e88e8ccdfd810d53.tar.gz
ravanan-d7a92a2976874cbb9584d943e88e8ccdfd810d53.tar.lz
ravanan-d7a92a2976874cbb9584d943e88e8ccdfd810d53.zip
tests: Canonicalize JSON trees before comparing them.
We must canonicalize JSON trees before comparing them since the order
of keys in JSON objects is insignificant.
Diffstat (limited to 'tests/javascript.scm')
-rw-r--r--tests/javascript.scm14
1 files changed, 8 insertions, 6 deletions
diff --git a/tests/javascript.scm b/tests/javascript.scm
index cf466b2..c670e98 100644
--- a/tests/javascript.scm
+++ b/tests/javascript.scm
@@ -20,6 +20,7 @@
              (guix gexp)
              (ice-9 match)
              (ravanan work monads)
+             (ravanan work utils)
              (ravanan javascript))
 
 (define (gexp->sexp-rec exp)
@@ -46,12 +47,13 @@
                                   '()))
 
 (test-equal "evaluate parameter reference to JSON object"
-  '(("class" . "File")
-    ("path" . "/foo/bar"))
-  (evaluate-javascript-expression "$(inputs.fasta)"
-                                  '(("inputs" ("fasta"
-                                               ("class" . "File")
-                                               ("path" . "/foo/bar"))))))
+  (canonicalize-json '(("class" . "File")
+                       ("path" . "/foo/bar")))
+  (canonicalize-json
+   (evaluate-javascript-expression "$(inputs.fasta)"
+                                   '(("inputs" ("fasta"
+                                                ("class" . "File")
+                                                ("path" . "/foo/bar")))))))
 
 (test-equal "evaluate parameter reference with string interpolation"
   "24foo12foobar"