mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-24 06:35:49 +03:00
Fixed failing regression tests
refs #10944 These tests were broken in the above PR
This commit is contained in:
parent
ff1ac49b0a
commit
9c2bb3811f
@ -782,6 +782,12 @@ Post = ghostBookshelf.Model.extend({
|
||||
edit: function edit(data, unfilteredOptions) {
|
||||
let options = this.filterOptions(unfilteredOptions, 'edit', {extraAllowedProperties: ['id']});
|
||||
|
||||
// @TODO DELETE THIS (and the failing regression tests) when v0.1 is ded
|
||||
if (Object.prototype.hasOwnProperty.call(data, 'page')) {
|
||||
data.type = data.page ? 'page' : 'post';
|
||||
delete data.page;
|
||||
}
|
||||
|
||||
const editPost = () => {
|
||||
options.forUpdate = true;
|
||||
|
||||
|
@ -80,7 +80,7 @@ describe('Schedules API', function () {
|
||||
published_at: moment().add(30, 'seconds').toDate(),
|
||||
status: 'scheduled',
|
||||
slug: 'fifth',
|
||||
page: true
|
||||
type: 'page'
|
||||
}));
|
||||
|
||||
return Promise.mapSeries(resources, function (post) {
|
||||
|
@ -25,6 +25,7 @@ const expectedProperties = {
|
||||
.without('status')
|
||||
// @TODO: https://github.com/TryGhost/Ghost/issues/10335
|
||||
// .without('page')
|
||||
.without('type')
|
||||
// v2 returns a calculated excerpt field
|
||||
.concat('excerpt')
|
||||
,
|
||||
|
@ -532,7 +532,7 @@ describe('Post Model', function () {
|
||||
}).then(function (edited) {
|
||||
should.exist(edited);
|
||||
edited.attributes.status.should.equal('draft');
|
||||
edited.attributes.page.should.equal(true);
|
||||
edited.attributes.type.should.equal('page');
|
||||
|
||||
Object.keys(eventsTriggered).length.should.eql(2);
|
||||
should.exist(eventsTriggered['post.deleted']);
|
||||
@ -542,7 +542,7 @@ describe('Post Model', function () {
|
||||
}).then(function (edited) {
|
||||
should.exist(edited);
|
||||
edited.attributes.status.should.equal('draft');
|
||||
edited.attributes.page.should.equal(false);
|
||||
edited.attributes.type.should.equal('post');
|
||||
|
||||
Object.keys(eventsTriggered).length.should.eql(4);
|
||||
should.exist(eventsTriggered['post.deleted']);
|
||||
@ -569,7 +569,7 @@ describe('Post Model', function () {
|
||||
}).then(function (edited) {
|
||||
should.exist(edited);
|
||||
edited.attributes.status.should.equal('scheduled');
|
||||
edited.attributes.page.should.equal(true);
|
||||
edited.attributes.type.should.equal('page');
|
||||
|
||||
Object.keys(eventsTriggered).length.should.eql(3);
|
||||
should.exist(eventsTriggered['post.deleted']);
|
||||
@ -580,7 +580,7 @@ describe('Post Model', function () {
|
||||
}).then(function (edited) {
|
||||
should.exist(edited);
|
||||
edited.attributes.status.should.equal('scheduled');
|
||||
edited.attributes.page.should.equal(false);
|
||||
edited.attributes.type.should.equal('post');
|
||||
|
||||
Object.keys(eventsTriggered).length.should.eql(7);
|
||||
should.exist(eventsTriggered['page.unscheduled']);
|
||||
@ -606,7 +606,7 @@ describe('Post Model', function () {
|
||||
}).then(function (edited) {
|
||||
should.exist(edited);
|
||||
edited.attributes.status.should.equal('published');
|
||||
edited.attributes.page.should.equal(true);
|
||||
edited.attributes.type.should.equal('page');
|
||||
|
||||
Object.keys(eventsTriggered).length.should.eql(4);
|
||||
should.exist(eventsTriggered['post.unpublished']);
|
||||
@ -618,7 +618,7 @@ describe('Post Model', function () {
|
||||
}).then(function (edited) {
|
||||
should.exist(edited);
|
||||
edited.attributes.status.should.equal('published');
|
||||
edited.attributes.page.should.equal(false);
|
||||
edited.attributes.type.should.equal('post');
|
||||
|
||||
Object.keys(eventsTriggered).length.should.eql(8);
|
||||
should.exist(eventsTriggered['page.unpublished']);
|
||||
@ -644,7 +644,7 @@ describe('Post Model', function () {
|
||||
}).then(function (edited) {
|
||||
should.exist(edited);
|
||||
edited.attributes.status.should.equal('published');
|
||||
edited.attributes.page.should.equal(true);
|
||||
edited.attributes.type.should.equal('page');
|
||||
|
||||
Object.keys(eventsTriggered).length.should.eql(5);
|
||||
should.exist(eventsTriggered['post.deleted']);
|
||||
@ -657,7 +657,7 @@ describe('Post Model', function () {
|
||||
}).then(function (edited) {
|
||||
should.exist(edited);
|
||||
edited.attributes.status.should.equal('draft');
|
||||
edited.attributes.page.should.equal(false);
|
||||
edited.attributes.type.should.equal('post');
|
||||
|
||||
Object.keys(eventsTriggered).length.should.eql(8);
|
||||
should.exist(eventsTriggered['page.unpublished']);
|
||||
@ -1175,7 +1175,7 @@ describe('Post Model', function () {
|
||||
page = results.toJSON();
|
||||
page.id.should.equal(firstItemData.id);
|
||||
page.status.should.equal('published');
|
||||
page.page.should.be.true();
|
||||
page.type.should.equal('page');
|
||||
|
||||
// Destroy the page
|
||||
return results.destroy(firstItemData);
|
||||
|
@ -1915,7 +1915,7 @@ describe('Integration - Web - Site', function () {
|
||||
response.statusCode.should.eql(200);
|
||||
response.template.should.eql('tag');
|
||||
|
||||
postSpy.args[0][0].options.filter.should.eql('(tags:\'bacon\'+tags.visibility:public)+page:false');
|
||||
postSpy.args[0][0].options.filter.should.eql('(tags:\'bacon\'+tags.visibility:public)+type:post');
|
||||
postSpy.args[0][0].options.page.should.eql(1);
|
||||
postSpy.args[0][0].options.limit.should.eql(2);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user