From d1b9e9412bb25a8b292340bba746fa62b2e3f14b Mon Sep 17 00:00:00 2001 From: David Mzareulyan Date: Tue, 30 May 2017 17:25:48 +0300 Subject: [PATCH] Make 'friendfeedUrl' field optional in test data schema --- test/functional/schemaV2-helper.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/test/functional/schemaV2-helper.js b/test/functional/schemaV2-helper.js index 6f3b5f9f..1ede985b 100644 --- a/test/functional/schemaV2-helper.js +++ b/test/functional/schemaV2-helper.js @@ -49,18 +49,17 @@ const postBasic = { likes: expect.it('to be an array').and('to be empty').or('to have items satisfying', UUID), omittedComments: expect.it('to be a number'), omittedLikes: expect.it('to be a number'), - friendfeedUrl: expect.it('to be a string').or('to be undefined'), }; export const post = (obj) => { - const isHidden = obj && typeof obj === 'object' && obj.isHidden; - if (!isHidden) { - return expect(obj, 'to exhaustively satisfy', postBasic); + const tpl = { ...postBasic }; + if (obj && typeof obj === 'object' && obj.isHidden) { + tpl.isHidden = expect.it('to be', true); } - return expect(obj, 'to exhaustively satisfy', { - ...postBasic, - isHidden: expect.it('to be', true), - }); + if (obj && typeof obj === 'object' && obj.friendfeedUrl) { + tpl.friendfeedUrl = expect.it('to be a string'); + } + return expect(obj, 'to exhaustively satisfy', tpl); }; const commentBasic = {