Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add licenseInformation, add tier test and honor onlyWWW #594

Merged
merged 3 commits into from
Mar 5, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 42 additions & 5 deletions src/tests/packageFiles/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,14 @@
});

const packageContent = require(packageJsonPath);
const iopackContent = require(ioPackageJsonPath);

const requiredProperties = [
"name",
"version",
"description",
"author",
"license",
"main",
"repository",
"repository.type",
];
Expand Down Expand Up @@ -126,6 +126,12 @@
);
});

if (!iopackContent.common.onlyWWW){

Check failure on line 129 in src/tests/packageFiles/index.ts

View workflow job for this annotation

GitHub Actions / check-and-lint (16.x)

Insert `·`
it(`property main is defined for non onlyWWW adapters`, () => {
expect(packageContent.main).to.not.be.undefined;
});
};

Check failure on line 133 in src/tests/packageFiles/index.ts

View workflow job for this annotation

GitHub Actions / check-and-lint (16.x)

Delete `;`

Check failure on line 134 in src/tests/packageFiles/index.ts

View workflow job for this annotation

GitHub Actions / check-and-lint (16.x)

Delete `↹↹↹`
it(`The repository type is "git"`, () => {
expect(packageContent.repository.type).to.equal("git");
});
Expand Down Expand Up @@ -164,7 +170,6 @@
"common.desc",
"common.icon",
"common.extIcon",
"common.license",
"common.type",
"common.authors",
"native",
Expand Down Expand Up @@ -204,6 +209,32 @@
expect(Object.keys(news).length).to.be.at.most(20);
});

if (iopackContent.common.licenseInformation) {
it(`if common.licenseInformation exists, it is an object with required properties`, () => {
expect(iopackContent.common.licenseInformation).to.be.an("object");

Check failure on line 214 in src/tests/packageFiles/index.ts

View workflow job for this annotation

GitHub Actions / check-and-lint (16.x)

Replace `"object"` with `⏎↹↹↹↹↹↹"object",⏎↹↹↹↹↹`
expect(iopackContent.common.licenseInformation.type).to.be.oneOf(['free', 'commercial', 'paid', 'limited']);

Check failure on line 215 in src/tests/packageFiles/index.ts

View workflow job for this annotation

GitHub Actions / check-and-lint (16.x)

Replace `iopackContent.common.licenseInformation.type).to.be.oneOf(['free',·'commercial',·'paid',·'limited'` with `⏎↹↹↹↹↹↹iopackContent.common.licenseInformation.type,⏎↹↹↹↹↹).to.be.oneOf(["free",·"commercial",·"paid",·"limited"`

if (iopackContent.common.licenseInformation.type !== "free") {

Check failure on line 217 in src/tests/packageFiles/index.ts

View workflow job for this annotation

GitHub Actions / check-and-lint (16.x)

Replace `iopackContent.common.licenseInformation.type·!==·"free"` with `⏎↹↹↹↹↹↹iopackContent.common.licenseInformation.type·!==·"free"⏎↹↹↹↹↹`
expect(iopackContent.common.licenseInformation.link, 'License link is missing').to.not.be.undefined;

Check failure on line 218 in src/tests/packageFiles/index.ts

View workflow job for this annotation

GitHub Actions / check-and-lint (16.x)

Replace `iopackContent.common.licenseInformation.link,·'License·link·is·missing'` with `⏎↹↹↹↹↹↹↹iopackContent.common.licenseInformation.link,⏎↹↹↹↹↹↹↹"License·link·is·missing",⏎↹↹↹↹↹↹`
}
});

it(`common.license should not exist together with common.licenseInformation`, () => {
expect(iopackContent.common.license, 'common.license must be removed').to.be.undefined;

Check failure on line 223 in src/tests/packageFiles/index.ts

View workflow job for this annotation

GitHub Actions / check-and-lint (16.x)

Replace `iopackContent.common.license,·'common.license·must·be·removed'` with `⏎↹↹↹↹↹↹iopackContent.common.license,⏎↹↹↹↹↹↹"common.license·must·be·removed",⏎↹↹↹↹↹`
});
} else {
it(`common.license must exist without common.licenseInformation`, () => {
expect(iopackContent.common.license, 'common.licenseInformation (preferred) or common.license (deprecated) must exist').to.not.be.undefined;

Check failure on line 227 in src/tests/packageFiles/index.ts

View workflow job for this annotation

GitHub Actions / check-and-lint (16.x)

Replace `iopackContent.common.license,·'common.licenseInformation·(preferred)·or·common.license·(deprecated)·must·exist'` with `⏎↹↹↹↹↹↹iopackContent.common.license,⏎↹↹↹↹↹↹"common.licenseInformation·(preferred)·or·common.license·(deprecated)·must·exist",⏎↹↹↹↹↹`
});

Check failure on line 228 in src/tests/packageFiles/index.ts

View workflow job for this annotation

GitHub Actions / check-and-lint (16.x)

Delete `↹`
}

if (iopackContent.common.tier != undefined) {
it(`common.tier must be 1, 2 or 3`, () => {
expect(iopackContent.common.tier).to.be.at.least(1);
expect(iopackContent.common.tier).to.be.at.most(3);
});
}

// If the adapter has a configuration page, check that a supported admin UI is used
const hasNoConfigPage =
iopackContent.common.noConfig === true ||
Expand Down Expand Up @@ -245,9 +276,15 @@
});

it("The license matches", () => {
expect(iopackContent.common.license).to.equal(
packageContent.license,
);
if (iopackContent.common.licenseInformation) {
expect(iopackContent.common.licenseInformation.license).to.equal(
packageContent.license,
);
} else {
expect(iopackContent.common.license).to.equal(
packageContent.license,
);
}
});
});
});
Expand Down
Loading