Add more and unify tests for absent object cases

- Unify test data for nonexistence of an object/string and collection.
- Introduce more test through adding missing test data to existing tests.
- Improve logic for checking absence of values to match tests.
- Add missing tests for absent value validation.
- Update documentation to include shared test functionality.
This commit is contained in:
undergroundwires
2022-01-21 22:34:11 +01:00
parent 0e52a99efa
commit 44d79e2c9a
100 changed files with 1380 additions and 976 deletions

View File

@@ -23,19 +23,16 @@ export class Application implements IApplication {
function validateInformation(info: IProjectInformation) {
if (!info) {
throw new Error('undefined project information');
throw new Error('missing project information');
}
}
function validateCollections(collections: readonly ICategoryCollection[]) {
if (!collections) {
throw new Error('undefined collections');
}
if (collections.length === 0) {
throw new Error('no collection in the list');
if (!collections || !collections.length) {
throw new Error('missing collections');
}
if (collections.filter((c) => !c).length > 0) {
throw new Error('undefined collection in the list');
throw new Error('missing collection in the list');
}
const osList = collections.map((c) => c.os);
const duplicates = getDuplicates(osList);