mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-01 13:54:35 +03:00
Fixed default mobiledoc handling in our data generator
no issue - the handling here was not correct - if you've passed no mobiledoc, it wasn't adding mobiledoc and an undefined html value - we need a default mobiledoc+html value in case you don't pass the values within the test cases
This commit is contained in:
parent
d32cea479e
commit
3dedfc7d61
@ -410,14 +410,22 @@ DataGenerator.forKnex = (function () {
|
|||||||
overrides = overrides || {};
|
overrides = overrides || {};
|
||||||
|
|
||||||
var newObj = _.cloneDeep(overrides),
|
var newObj = _.cloneDeep(overrides),
|
||||||
mobiledoc = JSON.parse(overrides.mobiledoc || '{}');
|
mobiledocObj;
|
||||||
|
|
||||||
|
if (!newObj.mobiledoc) {
|
||||||
|
newObj.mobiledoc = DataGenerator.markdownToMobiledoc('## markdown');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!newObj.html) {
|
||||||
|
mobiledocObj = JSON.parse(newObj.mobiledoc);
|
||||||
|
newObj.html = mobiledocObj.cards && mobiledocObj.cards[0][1].markdown;
|
||||||
|
}
|
||||||
|
|
||||||
return _.defaults(newObj, {
|
return _.defaults(newObj, {
|
||||||
id: ObjectId.generate(),
|
id: ObjectId.generate(),
|
||||||
uuid: uuid.v4(),
|
uuid: uuid.v4(),
|
||||||
title: 'title',
|
title: 'title',
|
||||||
status: 'published',
|
status: 'published',
|
||||||
html: mobiledoc.cards && mobiledoc.cards[0][1].markdown,
|
|
||||||
featured: true,
|
featured: true,
|
||||||
page: false,
|
page: false,
|
||||||
author_id: DataGenerator.Content.users[0].id,
|
author_id: DataGenerator.Content.users[0].id,
|
||||||
|
Loading…
Reference in New Issue
Block a user