Skip to content

Commit

Permalink
feat: add hexo post sample test
Browse files Browse the repository at this point in the history
  • Loading branch information
dimaslanjaka committed May 13, 2023
1 parent 217f1a0 commit daaf0ea
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,23 @@ describe('Front-matter', () => {
const data = yfm.parse(str);
parseInt(data.date.getTime() / 1000, 10).should.eql(parseInt(unixTime / 1000, 10));
});

it('hexo post yaml', () => {
const current = new Date();
const date = new Date(current.getTime() - (current.getTimezoneOffset() * 60 * 1000)).toJSON();
const str = [
'---',
'title: "hello world"',
'date: "' + date + '"',
'description: "description hello world"',
'---',
'bar'
].join('\n');
const parse = yfm.parse(str);
should.equal(parse.title, 'hello world');
should.equal(parse.description, 'description hello world');
should.equal(parse.date, date);
});
});

describe('stringify', () => {
Expand Down

0 comments on commit daaf0ea

Please sign in to comment.