Last active
January 30, 2017 18:12
-
-
Save samueljoli/2c514d9beda86265d6c070ef7febeeb5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // In request handler | |
| const document = { | |
| id : null, | |
| name: {first: null, last: null} | |
| }; | |
| // later in request handler | |
| document.id = Uuid.v4(); | |
| document.name.first = computedValues.firstName; | |
| document.name.last = computedValues.lastName; | |
| const docSchema = Joi.object().keys({ | |
| id: Joi.string().guid().required(), | |
| name: Joi.object().keys({ | |
| first: Joi.string().min(1).required(), | |
| last: Joi.string().min(1).required() | |
| }).required() | |
| }); | |
| // in test suite | |
| const completeMock = { | |
| id : 'c142c479-c56e-43a8-8f3c-5db38d8061c3', | |
| name: { | |
| first: 'Amelia', | |
| last : 'Pond' | |
| } | |
| }; | |
| const invalidMock = { | |
| id : 'c142c479-c56e-43a8-8f3c-5db38d8061c3', | |
| firstName: 'Martha', | |
| lastName : 'Jones' | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment