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

fix: permalink test

issue #6975
This commit is contained in:
kirrg001 2016-06-13 14:40:58 -04:00
parent 7d5baf4e9a
commit 2e25e4c73d
2 changed files with 16 additions and 7 deletions

View file

@ -346,12 +346,7 @@ describe('Post Model', function () {
});
it('can findOne, returning a dated permalink', function (done) {
var firstPost = 1,
today = testUtils.DataGenerator.Content.posts[0].published_at,
dd = ('0' + today.getDate()).slice(-2),
mm = ('0' + (today.getMonth() + 1)).slice(-2),
yyyy = today.getFullYear(),
postLink = '/' + yyyy + '/' + mm + '/' + dd + '/html-ipsum/';
var firstPost = 1;
configUtils.set({theme: {
permalinks: '/:year/:month/:day/:slug/'
@ -361,7 +356,10 @@ describe('Post Model', function () {
.then(function (result) {
should.exist(result);
firstPost = result.toJSON();
firstPost.url.should.equal(postLink);
// published_at of post 1 is 2015-01-01 00:00:00
// default blog TZ is UTC
firstPost.url.should.equal('/2015/01/01/html-ipsum/');
done();
}).catch(done);

View file

@ -413,6 +413,17 @@ describe('Config', function () {
config.urlPathForPost(testData).should.equal(postLink);
});
it('permalink is /:year/:month/:day/:slug, blog timezone is Asia Tokyo', function () {
config.theme.timezone = 'Asia/Tokyo';
config.theme.permalinks = '/:year/:month/:day/:slug/';
var testData = testUtils.DataGenerator.Content.posts[2],
postLink = '/2016/05/18/short-and-sweet/';
testData.published_at = new Date('2016-05-18T06:30:00.000Z');
config.urlPathForPost(testData).should.equal(postLink);
});
it('post is page, no permalink usage allowed at all', function () {
config.theme.timezone = 'America/Los_Angeles';
config.theme.permalinks = '/:year/:month/:day/:slug/';