From a5e597545cd6859fda703e3096c3660f1183fb31 Mon Sep 17 00:00:00 2001
From: "Alexander.Mart" <alex.mart.mail@gmail.com>
Date: Wed, 23 Apr 2025 23:35:58 +0300
Subject: [PATCH] test: check limit().evaluate()
 https://github.com/terminusdb/terminusdb/issues/2155

---
 test/woql.spec.js | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/test/woql.spec.js b/test/woql.spec.js
index 88b7581..fc85463 100644
--- a/test/woql.spec.js
+++ b/test/woql.spec.js
@@ -486,6 +486,7 @@ describe('woql queries', () => {
         }
       })
   });
+
   it('check deep arithmetic var', () => {
     let v = Vars("a", "res");
       const wq = WOQL.and(
@@ -496,4 +497,20 @@ describe('woql queries', () => {
     expect(wq).to.deep.eql(
       {"@type":"And","and":[{"@type":"Eval","expression":{"@type":"Times","left":{"@type":"ArithmeticValue","data":{"@type":"xsd:decimal","@value":3}},"right":{"@type":"ArithmeticValue","data":{"@type":"xsd:decimal","@value":4}}},"result":{"@type":"ArithmeticValue","variable":"a"}},{"@type":"Eval","expression":{"@type":"Times","left":{"@type":"ArithmeticValue","variable":"a"},"right":{"@type":"ArithmeticValue","data":{"@type":"xsd:decimal","@value":3}}},"result":{"@type":"ArithmeticValue","variable":"res"}}]})
   });
+
+  it('check limit().evaluate()', () => {
+    let v = Vars("result");
+    const woqlObject = WOQL.limit(100).evaluate(WOQL.times(2, 3), v.result);
+    const expectedJson = [
+      {
+        "result": {
+          "@type": "xsd:decimal",
+          "@value": 6
+        }
+      }
+    ];
+
+    expect(woqlObject.json()).to.deep.eql(expectedJson);
+  });
+
 });