diff --git a/lib/fail.js b/lib/fail.js index 47459c9..a7c3974 100644 --- a/lib/fail.js +++ b/lib/fail.js @@ -1,7 +1,7 @@ 'use strict'; /** - * @typedef {Record} FailureProperties + * @typedef {Record} FailureProperties */ /** diff --git a/test/failure.test.js b/test/failure.test.js index 9a7ea17..3d901f7 100644 --- a/test/failure.test.js +++ b/test/failure.test.js @@ -48,6 +48,18 @@ describe('failure', () => { assert.isUndefined(error.cause); }); + it('supports string arrays as error properties', () => { + const error = failure('Oups!', INVALID, { some: ['a', 'b'] }); + + assert.equals(error.properties, { some: ['a', 'b'] }); + }); + + it('supports number arrays as error properties', () => { + const error = failure('Oups!', INVALID, { some: [1, 2] }); + + assert.equals(error.properties, { some: [1, 2] }); + }); + it('does not allow to change the error code', () => { const error = failure('Oups!', INVALID);