Skip to content
Snippets Groups Projects
Commit 37035480 authored by Rhys Arkins's avatar Rhys Arkins
Browse files

refactor: validate list only if non-empty

parent 797c35ed
No related branches found
No related tags found
No related merge requests found
...@@ -90,7 +90,7 @@ function validateConfig(config) { ...@@ -90,7 +90,7 @@ function validateConfig(config) {
)} (${typeof val})`, )} (${typeof val})`,
}); });
} }
} else if (type === 'list') { } else if (type === 'list' && val) {
if (!Array.isArray(val)) { if (!Array.isArray(val)) {
errors.push({ errors.push({
depName: 'Configuration Error', depName: 'Configuration Error',
......
...@@ -35,8 +35,8 @@ describe('config/validation', () => { ...@@ -35,8 +35,8 @@ describe('config/validation', () => {
}; };
const { warnings, errors } = configValidation.validateConfig(config); const { warnings, errors } = configValidation.validateConfig(config);
expect(warnings).toHaveLength(0); expect(warnings).toHaveLength(0);
expect(errors).toHaveLength(9);
expect(errors).toMatchSnapshot(); expect(errors).toMatchSnapshot();
expect(errors).toHaveLength(9);
}); });
}); });
}); });
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment