Skip to content

Commit

Permalink
fix(config): Iterate over values provided instead of those allowed
Browse files Browse the repository at this point in the history
  • Loading branch information
bengourley committed Nov 19, 2019
1 parent 49a4658 commit fa55906
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/core/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ module.exports.schema = {
enabledBreadcrumbTypes: {
defaultValue: () => BREADCRUMB_TYPES,
message: `should be null or a list of available breadcrumb types (${BREADCRUMB_TYPES.join(',')})`,
validate: value => value === null || (isArray(value) && reduce(BREADCRUMB_TYPES, (accum, maybeType) => {
validate: value => value === null || (isArray(value) && reduce(value, (accum, maybeType) => {
if (accum === false) return accum
return includes(BREADCRUMB_TYPES, maybeType)
}, true))
Expand Down
7 changes: 7 additions & 0 deletions packages/core/test/config.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,11 @@ describe('@bugsnag/core/config', () => {
})
})
})

describe('enabledBreadcrumbTypes', () => {
it('fails when a supplied value is not a valid breadcrumb type', () => {
const enabledBreadcrumbTypesValidator = config.schema.enabledBreadcrumbTypes.validate
expect(enabledBreadcrumbTypesValidator(['UNKNOWN_BREADCRUMB_TYPE'])).toBe(false)
})
})
})

0 comments on commit fa55906

Please sign in to comment.