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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user