).toEqual(`["etag","ilike","%etagValue%"]`);
});
+ it("should add 'contains' rule", () => {
+ expect(
+ filters.addContains("properties.someProp", "someValue").getFilters()
+ ).toEqual(`["properties.someProp","contains","someValue"]`);
+ });
+
it("should add 'is_a' rule", () => {
expect(
filters.addIsA("etag", "etagValue").getFilters()
).toEqual(`["etag","in",["etagValue1","etagValue2"]]`);
});
+ it("should add 'not in' rule for set", () => {
+ expect(
+ filters.addNotIn("etag", ["etagValue1", "etagValue2"]).getFilters()
+ ).toEqual(`["etag","not in",["etagValue1","etagValue2"]]`);
+ });
+
it("should add multiple rules", () => {
expect(
filters
.getFilters())
.toEqual(`["myPrefix.etag","in",["etagValue1","etagValue2"]]`);
});
+
+ it('should add full text search', () => {
+ expect(
+ new FilterBuilder()
+ .addFullTextSearch('my custom search')
+ .getFilters()
+ ).toEqual(`["any","ilike","%my%"],["any","ilike","%custom%"],["any","ilike","%search%"]`);
+ });
});