[ARVADOS-WORKBENCH2] updated: 1.1.4-209-g9820e0e

Git user git at public.curoverse.com
Thu Jul 5 09:48:45 EDT 2018


Summary of changes:
 src/common/api/filter-builder.test.ts | 86 +++++++++++++++++++++++++++++++++++
 1 file changed, 86 insertions(+)
 create mode 100644 src/common/api/filter-builder.test.ts

       via  9820e0e8fc2e92de5c6b97a7b43a9ca54e5a2dd6 (commit)
      from  9ab26fe1f0838a97818416bd6b833fc74968ed65 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 9820e0e8fc2e92de5c6b97a7b43a9ca54e5a2dd6
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Thu Jul 5 15:48:29 2018 +0200

    Create FilterBuilder tests
    
    Feature #13703
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

diff --git a/src/common/api/filter-builder.test.ts b/src/common/api/filter-builder.test.ts
new file mode 100644
index 0000000..3424393
--- /dev/null
+++ b/src/common/api/filter-builder.test.ts
@@ -0,0 +1,86 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import FilterBuilder from "./filter-builder";
+
+describe("FilterBuilder", () => {
+
+    let filters: FilterBuilder;
+
+    beforeEach(() => {
+        filters = FilterBuilder.create();
+    });
+
+    it("should add 'equal' rule", () => {
+        expect(
+            filters.addEqual("etag", "etagValue").serialize()
+        ).toEqual(`[["etag","=","etagValue"]]`);
+    });
+
+    it("should add 'like' rule", () => {
+        expect(
+            filters.addLike("etag", "etagValue").serialize()
+        ).toEqual(`[["etag","like","%etagValue%"]]`);
+    });
+
+    it("should add 'ilike' rule", () => {
+        expect(
+            filters.addILike("etag", "etagValue").serialize()
+        ).toEqual(`[["etag","ilike","%etagValue%"]]`);
+    });
+
+    it("should add 'is_a' rule", () => {
+        expect(
+            filters.addIsA("etag", "etagValue").serialize()
+        ).toEqual(`[["etag","is_a","etagValue"]]`);
+    });
+
+    it("should add 'is_a' rule for set", () => {
+        expect(
+            filters.addIsA("etag", ["etagValue1", "etagValue2"]).serialize()
+        ).toEqual(`[["etag","is_a",["etagValue1","etagValue2"]]]`);
+    });
+
+    it("should add 'in' rule", () => {
+        expect(
+            filters.addIn("etag", "etagValue").serialize()
+        ).toEqual(`[["etag","in","etagValue"]]`);
+    });
+
+    it("should add 'in' rule for set", () => {
+        expect(
+            filters.addIn("etag", ["etagValue1", "etagValue2"]).serialize()
+        ).toEqual(`[["etag","in",["etagValue1","etagValue2"]]]`);
+    });
+
+    it("should add multiple rules", () => {
+        expect(
+            filters
+                .addIn("etag", ["etagValue1", "etagValue2"])
+                .addEqual("href", "hrefValue")
+                .serialize()
+        ).toEqual(`[["etag","in",["etagValue1","etagValue2"]],["href","=","hrefValue"]]`);
+    });
+
+    it("should concatenate multiple builders", () => {
+        expect(
+            filters
+                .concat(FilterBuilder.create().addIn("etag", ["etagValue1", "etagValue2"]))
+                .concat(FilterBuilder.create().addEqual("href", "hrefValue"))
+                .serialize()
+        ).toEqual(`[["etag","in",["etagValue1","etagValue2"]],["href","=","hrefValue"]]`);
+    });
+
+    it("should add attribute prefix", () => {
+        expect(FilterBuilder
+            .create("myPrefix")
+            .addIn("etag", ["etagValue1", "etagValue2"])
+            .serialize())
+            .toEqual(`[["my_prefix.etag","in",["etagValue1","etagValue2"]]]`);
+    });
+
+
+
+
+});

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list