Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
uiolee committed Jan 9, 2025
1 parent a13326d commit bc7bb94
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions test/scripts/filters/post_permalink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import Hexo from '../../../lib/hexo';
import postPermalinkFilter from '../../../lib/plugins/filter/post_permalink';
type PostPermalinkFilterParams = Parameters<typeof postPermalinkFilter>;
type PostPermalinkFilterReturn = ReturnType<typeof postPermalinkFilter>;

import chai from 'chai';
const should = chai.should();
describe('post_permalink', () => {
const hexo = new Hexo();
const postPermalink: (...args: PostPermalinkFilterParams) => PostPermalinkFilterReturn = postPermalinkFilter.bind(hexo);
Expand Down Expand Up @@ -99,15 +100,15 @@ describe('post_permalink', () => {
it('timestamp', async () => {
hexo.config.timezone = 'UTC';
hexo.config.permalink = ':day/:hour/:timestamp/';
const date = moment('2025-01-09 22:45:14');
const timestamp = '1736433914';
const date = moment('2025-01-09 05:45:14');
const timestamp = '1736372714';
const post = await Post.insert({
source: 'sub/test-timestamp-post.md',
slug: 'test-timestamp-post',
title: 'My New Post',
date: date
});
postPermalink(post).should.eql(`09/22/${timestamp}/`);
postPermalink(post).should.eql(`09/05/${timestamp}/`);
Post.removeById(post._id);
hexo.config.timezone = '';
});
Expand Down

0 comments on commit bc7bb94

Please sign in to comment.