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:
kirrg001 2018-04-06 13:36:03 +02:00
parent fa4e2cf286
commit f114f45740

View File

@ -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 = {