diff --git a/models/build.js b/models/build.js index 9c47fac5..4163a944 100644 --- a/models/build.js +++ b/models/build.js @@ -139,10 +139,8 @@ module.exports = { * @property update * @type {Joi} */ - update: Joi.object(mutate(MODEL, [ - 'status' - ], [ - 'meta', 'statusMessage' + update: Joi.object(mutate(MODEL, [], [ + 'status', 'meta', 'statusMessage' ])).label('Update Build'), /** diff --git a/test/data/build.update.optional.yaml b/test/data/build.update.optional.yaml new file mode 100644 index 00000000..3d7227f8 --- /dev/null +++ b/test/data/build.update.optional.yaml @@ -0,0 +1,2 @@ +# Build Update Example +statusMessage: 'Build failed to start due to infrastructure error' diff --git a/test/models/build.test.js b/test/models/build.test.js index 094ec651..96aee516 100644 --- a/test/models/build.test.js +++ b/test/models/build.test.js @@ -30,6 +30,10 @@ describe('model build', () => { assert.isNull(validate('build.update.yaml', models.build.update).error); }); + it('validates the update with only statusMessage', () => { + assert.isNull(validate('build.update.optional.yaml', models.build.update).error); + }); + it('fails the update', () => { assert.isNotNull(validate('empty.yaml', models.build.update).error); });