@labdigital/commercetools-mock 2.53.1 → 2.53.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@labdigital/commercetools-mock",
3
- "version": "2.53.1",
3
+ "version": "2.53.2",
4
4
  "license": "MIT",
5
5
  "author": "Michael van Tellingen",
6
6
  "type": "module",
@@ -151,6 +151,45 @@ describe("Predicate filter", () => {
151
151
  expect(match("numberProperty in (1234)")).toBeTruthy();
152
152
  });
153
153
 
154
+ test("in operator with and clause", async () => {
155
+ expect(
156
+ match("numberProperty in (1234) and stringProperty=:val", {
157
+ val: "foobar",
158
+ }),
159
+ ).toBeTruthy();
160
+ expect(
161
+ match("numberProperty in (1234) and stringProperty=:val", {
162
+ val: "other",
163
+ }),
164
+ ).toBeFalsy();
165
+ expect(
166
+ match("numberProperty in (1235) and stringProperty=:val", {
167
+ val: "foobar",
168
+ }),
169
+ ).toBeFalsy();
170
+ });
171
+
172
+ test("within operator with and clause", async () => {
173
+ expect(
174
+ match(
175
+ "geoLocation within circle(5.121310867198959, 52.09068804569714, 2500) and stringProperty=:val",
176
+ { val: "foobar" },
177
+ ),
178
+ ).toBeTruthy();
179
+ expect(
180
+ match(
181
+ "geoLocation within circle(5.121310867198959, 52.09068804569714, 2500) and stringProperty=:val",
182
+ { val: "other" },
183
+ ),
184
+ ).toBeFalsy();
185
+ expect(
186
+ match(
187
+ "geoLocation within circle(5.121310867198959, 52.09068804569714, 1000) and stringProperty=:val",
188
+ { val: "foobar" },
189
+ ),
190
+ ).toBeFalsy();
191
+ });
192
+
154
193
  test("arrayProperty contains all (...)", async () => {
155
194
  expect(match(`arrayProperty contains all ("foo", "bar")`)).toBeTruthy();
156
195
  expect(
@@ -382,6 +382,7 @@ const generateMatchFunc = (predicate: string): MatchFunc => {
382
382
  })
383
383
  .led("IN", 20, ({ left, bp }) => {
384
384
  const expr = parser.parse({ terminals: [bp - 1] });
385
+ lexer.expect(")");
385
386
  return (obj: any, vars: object) => {
386
387
  let symbols = expr;
387
388
  if (!Array.isArray(symbols)) {
@@ -426,6 +427,7 @@ const generateMatchFunc = (predicate: string): MatchFunc => {
426
427
 
427
428
  lexer.expect("(");
428
429
  const expr = parser.parse({ terminals: [")"] });
430
+ lexer.expect(")");
429
431
 
430
432
  return (obj: any, vars: object) => {
431
433
  const value = resolveValue(obj, left);