const test = require("ava"); const path = require("path"); const Posts = require("../../src/domain/posts.js")( { folder: path.resolve(__dirname, "../testsite/posts/"), taxonomies: { tag: "tags", category: "categories" } }, basename => basename ); test("get", t => { const expected = new Map( Object.entries({ title: "This is a test", description: "Test file", date: new Date("2017-01-01T00:00:00Z"), tags: ["a", "b"] }) ); const post = Posts.get( basename => basename, path.resolve(__dirname, "../testsite/posts/testfile.md") ); t.deepEqual(post.data, expected); t.is(post.basename, "testfile", "must include basename"); });