telefonicaid / iotagent-node-lib

Module to enable IoT Agent developers to build custom agents for their devices that can easily connect to NGSI Context Brokers
https://iotagent-node-lib.rtfd.io/
GNU Affero General Public License v3.0
58 stars 84 forks source link

Add tests using explicitAttrs with value `[ ]` #1605

Closed mapedraza closed 1 month ago

mapedraza commented 2 months ago

Adding tests described in #1600

BUT some problems were discovered when using TimeInstant attribute and fucntionalities in cases 533 A) and B):

0533 B

Assertion Error - Context Broker received payload differs from expectation
+ expected - actual

-{
-  "TimeInstant": {
-    "type": "DateTime"
-    "value": "2015-12-14T08:06:01.468Z"
-  }
-  "id": "TestType:TestDevice"
-  "type": "TestType"
-}
+{}

0533 B

Assertion Error - Context Broker received payload differs from expectation
+ expected - actual

-{
-  "DateIssued": {
-    "metadata": {
-      "TimeInstant": {
-        "type": "DateTime"
-        "value": "2024-04-29T16:07:27.281Z"
-      }
-    }
-    "type": "DateTime"
-    "value": "2015-12-14T08:06:01.468Z"
-  }
-  "TimeInstant": {
-    "type": "DateTime"
-    "value": "2024-04-29T16:07:27.281Z"
-  }
-  "id": "TestType:TestDevice"
-  "type": "TestType"
-}
+{}
mapedraza commented 1 month ago

As discussed, this PR should be divided in 2

fgalan commented 1 month ago

As discussed, this PR should be divided in 2

One of then with working tests 0531 and 0532, to be merged (closing #1600) and other PR with 0533 to be on hold as a regression tests for issue #1606

AlvaroVega commented 1 month ago

These tests are related with PR https://github.com/telefonicaid/iotagent-node-lib/pull/1593 and described as

So not sure if a measure mapped to TimeInstnat attribute should not be propagated to CB in this case.

mapedraza commented 1 month ago
  • behaviours

As my understanding, TimeInstant should work as any other attribute, so, it should be filtered by explicitAttrs like any other attribute.

mapedraza commented 1 month ago

As discussed, this PR should be divided in 2

One of then with working tests 0531 and 0532, to be merged (closing #1600) and other PR with 0533 to be on hold as a regression tests for issue #1606

Tests 533 removed here: https://github.com/telefonicaid/iotagent-node-lib/pull/1605/commits/c7426811b164631d200d48372527b783ced77e78