From 36f883d917d4fccd12322305320afd0325ecb305 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Fri, 13 Oct 2023 11:28:50 -0400 Subject: [PATCH 1/3] Add a test attribute in api_maturity and make sure unit tests pass --- test/gen-meta.test.js | 40 +++++++++++++++++++---------- test/resource/meta/api_maturity.xml | 3 +++ 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/test/gen-meta.test.js b/test/gen-meta.test.js index fd94ac8291..9197d89c16 100644 --- a/test/gen-meta.test.js +++ b/test/gen-meta.test.js @@ -71,21 +71,33 @@ test( const attributes = await queryZcl.selectAllAttributes(db, [ zclContext.packageId, ]) - expect(attributes.length).toBe(4) - expect(attributes[0].name).toBe('at1') - expect(attributes[1].name).toBe('at2') + expect(attributes.length).toBeGreaterThanOrEqual(4) - let access - access = await queryAccess.selectAttributeAccess(db, attributes[0].id) - expect(access.length).toBe(1) - expect(access[0].operation).toBe('write') - expect(access[0].role).toBe('manage') - expect(access[0].accessModifier).toBe('fabric-scoped') - access = await queryAccess.selectAttributeAccess(db, attributes[1].id) - expect(access.length).toBe(1) - expect(access[0].operation).toBeNull() - expect(access[0].role).toBeNull() - expect(access[0].accessModifier).toBe('fabric-sensitive') + // Expect attributes at1 and at2 to be found + let hasAt1 = false + let hasAt2 = false + + for (const attr of attributes) { + if (attr.name == 'at1') { + hasAt1 = true + + let access = await queryAccess.selectAttributeAccess(db, attr.id) + expect(access.length).toBe(1) + expect(access[0].operation).toBe('write') + expect(access[0].role).toBe('manage') + expect(access[0].accessModifier).toBe('fabric-scoped') + } else if (attr.name == 'at2') { + hasAt2 = true + + let access = await queryAccess.selectAttributeAccess(db, attr.id) + expect(access.length).toBe(1) + expect(access[0].operation).toBeNull() + expect(access[0].role).toBeNull() + expect(access[0].accessModifier).toBe('fabric-sensitive') + } + } + expect(hasAt1).toBeTruthy() + expect(hasAt2).toBeTruthy() const structs = await queryZcl.selectAllStructsWithItemCount(db, [ zclContext.packageId, diff --git a/test/resource/meta/api_maturity.xml b/test/resource/meta/api_maturity.xml index 029534ed7b..528dc5417e 100644 --- a/test/resource/meta/api_maturity.xml +++ b/test/resource/meta/api_maturity.xml @@ -25,6 +25,9 @@ limitations under the License. false true + + StableAttribute + From bcbcaf122786e8b9544b11f1a5cea35e50ef2ed9 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Fri, 13 Oct 2023 11:31:43 -0400 Subject: [PATCH 2/3] Fix up invalid comment --- test/resource/meta/api_maturity.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/test/resource/meta/api_maturity.xml b/test/resource/meta/api_maturity.xml index 528dc5417e..f62f628606 100644 --- a/test/resource/meta/api_maturity.xml +++ b/test/resource/meta/api_maturity.xml @@ -25,7 +25,6 @@ limitations under the License. false true - StableAttribute From 294505651d2a710ed39cca4659e7f152a4977f69 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Fri, 13 Oct 2023 12:25:32 -0400 Subject: [PATCH 3/3] Update order for maturity --- test/resource/meta/api_maturity.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/resource/meta/api_maturity.xml b/test/resource/meta/api_maturity.xml index f62f628606..90e519e94a 100644 --- a/test/resource/meta/api_maturity.xml +++ b/test/resource/meta/api_maturity.xml @@ -25,14 +25,14 @@ limitations under the License. false true - StableAttribute - + StableAttribute + A Test command