From fe38ca5b8d7d6d7daf0a9fbb9a89d3159948a8e0 Mon Sep 17 00:00:00 2001 From: Matthias Kleine Date: Wed, 21 Feb 2024 17:07:28 +0100 Subject: [PATCH] Check for common.licenseInformation --- src/tests/packageFiles/index.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/tests/packageFiles/index.ts b/src/tests/packageFiles/index.ts index ec9d77fc..221bdea5 100644 --- a/src/tests/packageFiles/index.ts +++ b/src/tests/packageFiles/index.ts @@ -164,7 +164,7 @@ export function validatePackageFiles(adapterDir: string): void { "common.desc", "common.icon", "common.extIcon", - "common.license", + "common.licenseInformation", "common.type", "common.authors", "native", @@ -204,6 +204,15 @@ export function validatePackageFiles(adapterDir: string): void { expect(Object.keys(news).length).to.be.at.most(20); }); + it(`common.licenseInformation is an object with required properties`, () => { + expect(iopackContent.common.licenseInformation).to.be.an("object"); + expect(iopackContent.common.licenseInformation.type).to.be.oneOf(['free', 'commercial', 'paid', 'limited']); + + if (iopackContent.common.licenseInformation.type !== "free") { + expect(iopackContent.common.licenseInformation.link, 'License link is missing').to.not.be.undefined; + } + }); + // If the adapter has a configuration page, check that a supported admin UI is used const hasNoConfigPage = iopackContent.common.noConfig === true || @@ -245,7 +254,7 @@ export function validatePackageFiles(adapterDir: string): void { }); it("The license matches", () => { - expect(iopackContent.common.license).to.equal( + expect(iopackContent.common.licenseInformation.license).to.equal( packageContent.license, ); });