Skip to content

Commit

Permalink
Make 'friendfeedUrl' field optional in test data schema
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmz committed May 30, 2017
1 parent e881ed5 commit d1b9e94
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions test/functional/schemaV2-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down

0 comments on commit d1b9e94

Please sign in to comment.