mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 14:03:48 +03:00
Added a post unit test to proof a bug
no issue - permalink: /:primary_tag/:slug/, columns: [title,url] - will be auto resolved with channels - the test should fail if we add channels
This commit is contained in:
parent
fa4e2cf286
commit
f114f45740
@ -5,6 +5,7 @@ const should = require('should'), // jshint ignore:line
|
||||
_ = require('lodash'),
|
||||
testUtils = require('../../utils'),
|
||||
knex = require('../../../server/data/db').knex,
|
||||
settingsCache = require('../../../server/services/settings/cache'),
|
||||
models = require('../../../server/models'),
|
||||
common = require('../../../server/lib/common'),
|
||||
security = require('../../../server/lib/security'),
|
||||
@ -39,6 +40,22 @@ describe('Unit: models/post', function () {
|
||||
sandbox.restore();
|
||||
});
|
||||
|
||||
describe('findPage', function () {
|
||||
/**
|
||||
* This is a @bug.
|
||||
* If you don't include tags, we can't generate the url properly.
|
||||
* Will be fixed when merging channels, because the post model has no longer generate the url.
|
||||
*/
|
||||
it('[bug] permalink: /:primary_tag/:slug/, columns: [title,url]', function () {
|
||||
sandbox.stub(settingsCache, 'get').withArgs('permalinks').returns('/:primary_tag/:slug/');
|
||||
|
||||
return models.Post.findPage({columns: ['title', 'url']})
|
||||
.then(function (result) {
|
||||
result.posts[0].url.should.eql('/all/html-ipsum/');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Edit', function () {
|
||||
it('update post, relation has not changed', function () {
|
||||
const events = {
|
||||
|
Loading…
Reference in New Issue
Block a user