blogs
Version:
A simple blog generator.
43 lines (35 loc) • 928 B
JavaScript
var assert = require('assert');
var path = require('path');
var Blog = require('../lib/-blog');
var Post = require('../lib/-post');
describe('Post', function () {
var blog;
var post;
beforeEach(function () {
var dir = path.join(__dirname, '../sample');
blog = new Blog(dir);
post = new Post(blog, path.join(dir, 'posts/test.html'));
});
it('should have blog', function () {
assert.equal(post.blog, blog);
});
it('should have file', function () {
assert.equal(post.file, path.join(__dirname, '../sample/posts/test.html'));
});
it('should load data', function (done) {
post.load((error, post) => {
assert.deepEqual({
error: error,
title: post.title,
date: post.date,
permalink: post.permalink
}, {
error: null,
title: 'A List of Characters!',
date: new Date('2016-05-01T00:00:00Z'),
permalink: '/2016/05/a-list-of-characters.html'
});
done();
});
});
});