@balena/odata-parser 2.4.1 → 2.4.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.
@@ -1,3 +1,14 @@
1
+ - commits:
2
+ - subject: Test that `/$count` works with a `$filter`containing an 'and'
3
+ hash: cda0a1a54b2830cd393240dd5dddf1e4b42877c4
4
+ body: ""
5
+ footer:
6
+ Change-type: patch
7
+ change-type: patch
8
+ author: Thodoris Greasidis
9
+ version: 2.4.2
10
+ title: ""
11
+ date: 2022-11-03T09:07:24.960Z
1
12
  - commits:
2
13
  - subject: Switch from balenaCI to flowzone
3
14
  hash: 3e0435348860242b9252c2725427a42e28925b4f
@@ -8,7 +19,7 @@
8
19
  author: Pagan Gazzard
9
20
  version: 2.4.1
10
21
  title: ""
11
- date: 2022-10-14T16:21:02.394Z
22
+ date: 2022-10-14T16:23:39.381Z
12
23
  - commits:
13
24
  - subject: Add support for `/$count` with nested `$filter` in $orderby & $orderby
14
25
  hash: 350c08b3a8a8877290f1c753a57e86404f0d9548
package/CHANGELOG.md CHANGED
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file
4
4
  automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY!
5
5
  This project adheres to [Semantic Versioning](http://semver.org/).
6
6
 
7
+ # v2.4.2
8
+ ## (2022-11-03)
9
+
10
+ * Test that `/$count` works with a `$filter`containing an 'and' [Thodoris Greasidis]
11
+
7
12
  # v2.4.1
8
13
  ## (2022-10-14)
9
14
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@balena/odata-parser",
3
- "version": "2.4.1",
3
+ "version": "2.4.2",
4
4
  "description": "An OData parser written in OMeta",
5
5
  "main": "odata-parser.js",
6
6
  "scripts": {
@@ -42,6 +42,6 @@
42
42
  "_": "test/run.js"
43
43
  },
44
44
  "versionist": {
45
- "publishedAt": "2022-10-14T16:21:02.571Z"
45
+ "publishedAt": "2022-11-03T09:07:25.110Z"
46
46
  }
47
47
  }
package/test/filterby.js CHANGED
@@ -422,16 +422,16 @@ export default function (test) {
422
422
 
423
423
  it('count options are present on the Product count', () => {
424
424
  assert.notEqual(result.options.$filter[1].options, null);
425
- console.log('***', result.options.$filter[1].options);
426
425
  });
427
426
 
428
427
  it('A filter should be present on the Product count lhs', () =>
429
428
  assert.notEqual(result.options.$filter[1].options.$filter, null));
430
429
 
431
- it(`has a Product count filter that is an instance of 'ge'`, () =>
432
- assert.equal(result.options.$filter[1].options.$filter[0], 'lt'));
430
+ it(`has a Product count filter that is an instance of 'lt'`, () => {
431
+ assert.equal(result.options.$filter[1].options.$filter[0], 'lt');
432
+ });
433
433
 
434
- it(`has an lhs on the Product count filter that is an instance of 'ge'`, () => {
434
+ it(`has an lhs on the Product count filter that is 'Price'`, () => {
435
435
  expect(result.options.$filter[1].options.$filter[1])
436
436
  .to.have.property('name')
437
437
  .that.equals('Price');
@@ -443,8 +443,54 @@ export default function (test) {
443
443
  .that.equals(0);
444
444
  });
445
445
 
446
- it('rhr should be $1', () =>
447
- assert.equal(result.options.$filter[2].bind, 1));
446
+ it('rhr should be $1', () => {
447
+ assert.equal(result.options.$filter[2].bind, 1);
448
+ });
449
+ },
450
+ );
451
+
452
+ test(
453
+ '$filter=Products/$count($filter=Price gt 5 and Price lt 10) ge 1',
454
+ [5, 10, 1],
455
+ function (result) {
456
+ it('A filter should be present', () =>
457
+ assert.notEqual(result.options.$filter, null));
458
+
459
+ it("Filter should be an instance of 'ge'", () =>
460
+ assert.equal(result.options.$filter[0], 'ge'));
461
+
462
+ it('lhr should have the Product count', function () {
463
+ expect(result.options.$filter[1]).to.have.property('name', 'Products');
464
+ expect(result.options.$filter[1]).to.have.property('count', true);
465
+ });
466
+
467
+ it('count options are present on the Product count', () => {
468
+ assert.notEqual(result.options.$filter[1].options, null);
469
+ });
470
+
471
+ it('A filter should be present on the Product count lhs', () =>
472
+ assert.notEqual(result.options.$filter[1].options.$filter, null));
473
+
474
+ it(`has a Product count filter that is an instance of 'and'`, () =>
475
+ assert.equal(result.options.$filter[1].options.$filter[0], 'and'));
476
+
477
+ it(`has an lhs on the 'and' of the Product count filter that is Price gt $0`, () => {
478
+ const filter = result.options.$filter[1].options.$filter[1];
479
+ assert.equal(filter[0], 'gt');
480
+ expect(filter[1]).to.have.property('name', 'Price');
481
+ expect(filter[2]).to.have.property('bind', 0);
482
+ });
483
+
484
+ it(`has an lhs on the 'and' of the Product count filter that is Price lt $1`, () => {
485
+ const filter = result.options.$filter[1].options.$filter[2];
486
+ assert.equal(filter[0], 'lt');
487
+ expect(filter[1]).to.have.property('name', 'Price');
488
+ expect(filter[2]).to.have.property('bind', 1);
489
+ });
490
+
491
+ it('rhr should be $2', () => {
492
+ assert.equal(result.options.$filter[2].bind, 2);
493
+ });
448
494
  },
449
495
  );
450
496