about summary refs log tree commit diff stats
path: root/test/domain
diff options
context:
space:
mode:
Diffstat (limited to 'test/domain')
-rw-r--r--test/domain/posts.test.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/domain/posts.test.js b/test/domain/posts.test.js
new file mode 100644
index 0000000..8866f40
--- /dev/null
+++ b/test/domain/posts.test.js
@@ -0,0 +1,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')
+})