Skip to content

Commit

Permalink
Added regression test for editing a scheduled post
Browse files Browse the repository at this point in the history
refs TryGhost#10600

- ensure it does not happen again
- we only have some regression model tests, which edit scheduled posts
  • Loading branch information
kirrg001 committed Mar 12, 2019
1 parent f6f35eb commit 7bac182
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions core/test/regression/api/v2/admin/posts_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,32 @@ describe('Posts API', function () {
model.get('updated_at').toISOString().should.not.eql(post.updated_at);
});
});

it('Can change scheduled post', function () {
return request
.get(localUtils.API.getApiQuery(`posts/${testUtils.DataGenerator.Content.posts[7].id}/`))
.set('Origin', config.get('url'))
.expect(200)
.then((res) => {
res.body.posts[0].status.should.eql('scheduled');

return request
.put(localUtils.API.getApiQuery('posts/' + testUtils.DataGenerator.Content.posts[7].id + '/'))
.set('Origin', config.get('url'))
.send({
posts: [{
title: 'change scheduled post',
updated_at: res.body.posts[0].updated_at
}]
})
.expect('Content-Type', /json/)
.expect('Cache-Control', testUtils.cacheRules.private)
.expect(200);
})
.then((res) => {
should.exist(res.headers['x-cache-invalidate']);
});
});
});

describe('destroy', function () {
Expand Down

0 comments on commit 7bac182

Please sign in to comment.