0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00

Added coverage for absolute urls being generated on post's included tags (#9924)

no-issue
This commit is contained in:
Nazar Gargol 2018-09-30 21:48:31 +02:00 committed by Katharina Irrgang
parent efc5219afa
commit 4368aa194a

View file

@ -88,6 +88,33 @@ describe('Public API', function () {
});
});
it('browse posts: request to include tags with absolute_urls', function (done) {
request.get(testUtils.API.getApiQuery('posts/?client_id=ghost-admin&client_secret=not_available&absolute_urls=true&include=tags'))
.set('Origin', testUtils.API.getURL())
.expect('Content-Type', /json/)
.expect('Cache-Control', testUtils.cacheRules.private)
.expect(200)
.end(function (err, res) {
if (err) {
return done(err);
}
should.exist(res.body.posts);
// kitchen sink
res.body.posts[9].slug.should.eql(testUtils.DataGenerator.Content.posts[1].slug);
should.exist(res.body.posts[9].tags);
should.exist(res.body.posts[9].tags[0].url);
const urlParts = url.parse(res.body.posts[9].tags[0].url);
should.exist(urlParts.protocol);
should.exist(urlParts.host);
done();
});
});
it('browse posts from different origin', function (done) {
request.get(testUtils.API.getApiQuery('posts/?client_id=ghost-test&client_secret=not_available'))
.set('Origin', 'https://example.com')