From 330521ad57cee1d862ef269439d4dd4de4cdc727 Mon Sep 17 00:00:00 2001 From: Timotej Ecimovic Date: Wed, 29 Jun 2022 07:45:41 -0400 Subject: [PATCH] Add unit test for event field type checking. https://github.com/project-chip/zap/issues/572 --- package.json | 1 + test/gen-template/matter/events.zapt | 8 ++++++++ test/gen-template/matter/gen-test.json | 5 +++++ test/test-util.js | 2 +- zcl-builtin/matter/test-cluster.xml | 2 +- 5 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 test/gen-template/matter/events.zapt diff --git a/package.json b/package.json index df58ea96e6..b771ddf9c9 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "lintfix": "eslint --fix --ext .js,.vue src src-electron src-shared src-script test", "electron-build-dmg": "node src-script/build-dmg.js", "clean:report": "rm -rf .nyc_output || true", + "tsc": "tsc --build ./tsconfig.json", "test": " npm run test:unit && npm run test:e2e-ci && npm run report", "test:unit": "node src-script/zap-versionstamp.js && jest --reporters=jest-junit --reporters=default --updateSnapshot", "test:unit:verbose": "jest --updateSnapshot --verbose false", diff --git a/test/gen-template/matter/events.zapt b/test/gen-template/matter/events.zapt new file mode 100644 index 0000000000..a6dd68542f --- /dev/null +++ b/test/gen-template/matter/events.zapt @@ -0,0 +1,8 @@ +List of all events. + +{{#zcl_events}} +>> Event: {{name}} +{{#zcl_event_fields}} + > Field: {{name}} {{#if_is_enum type}}[ENUM]{{/if_is_enum}}{{#if_is_bitmap type}}[BITMAP]{{/if_is_bitmap}} +{{/zcl_event_fields}} +{{/zcl_events}} \ No newline at end of file diff --git a/test/gen-template/matter/gen-test.json b/test/gen-template/matter/gen-test.json index ce6309a25a..0796191311 100644 --- a/test/gen-template/matter/gen-test.json +++ b/test/gen-template/matter/gen-test.json @@ -55,6 +55,11 @@ "path": "endpoint-config.zapt", "name": "Endpoint Configuration", "output": "endpoint-config.c" + }, + { + "path": "events.zapt", + "name": "Events", + "output": "events.out" } ] } diff --git a/test/test-util.js b/test/test-util.js index 061ede2ec7..2323d28e3d 100644 --- a/test/test-util.js +++ b/test/test-util.js @@ -80,7 +80,7 @@ exports.testTemplate = { zigbee: './test/gen-template/zigbee/gen-templates.json', zigbeeCount: 27, matter: './test/gen-template/matter/gen-test.json', - matterCount: 5, + matterCount: 6, dotdot: './test/gen-template/dotdot/dotdot-templates.json', dotdotCount: 5, unittest: './test/gen-template/test/gen-test.json', diff --git a/zcl-builtin/matter/test-cluster.xml b/zcl-builtin/matter/test-cluster.xml index 587c282fef..ddea69d10e 100644 --- a/zcl-builtin/matter/test-cluster.xml +++ b/zcl-builtin/matter/test-cluster.xml @@ -570,7 +570,7 @@ limitations under the License. - +