summary refs log tree commit diff stats
path: root/test/domain/posts.test.js
blob: 8866f40a56520a91684d001d2550364256e0a4e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const test = require('ava')
const path = require('path')

const Posts = require('../../src/domain/posts.js')({
  folder: path.resolve('../data', __dirname),
  taxonomies: {
    tag: 'tags',
    category: 'categories'
  }
})

test('get', t => {
  const expected = new Map(
    Object.entries({
      title: 'This is a test',
      description: 'Test file',
      tags: ['a', 'b']
    })
  )
  const post = Posts.get(path.resolve(__dirname, '../data/testfile.md'))
  t.deepEqual(post.data, expected)
  t.is(post.basename, 'testfile', 'must include basename')
})