diff options
Diffstat (limited to 'test/domain')
-rw-r--r-- | test/domain/posts.test.js | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/test/domain/posts.test.js b/test/domain/posts.test.js index 8b27698..bb97361 100644 --- a/test/domain/posts.test.js +++ b/test/domain/posts.test.js @@ -1,18 +1,22 @@ 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 -); +const Posts = require("../../src/domain/posts.js"); -test("get", t => { +test.beforeEach(async t => { + t.context = await Posts( + { + folder: path.resolve(__dirname, "../testsite/posts/"), + taxonomies: { + tag: "tags", + category: "categories" + } + }, + basename => basename + ); +}); + +test("get", async t => { const expected = new Map( Object.entries({ title: "This is a test", @@ -21,7 +25,7 @@ test("get", t => { tags: ["a", "b"] }) ); - const post = Posts.get( + const post = await t.context.get( basename => basename, path.resolve(__dirname, "../testsite/posts/testfile.md") ); |