From 2d931962b74fe06c1bfbc2454fa166d24e8e2f59 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 1 Jul 2017 14:11:52 +0200 Subject: feat: Add date to posts --- test/app.test.js | 23 +++++++++++++++++++++++ test/domain/posts.test.js | 1 + test/testsite/posts/testfile.md | 1 + 3 files changed, 25 insertions(+) (limited to 'test') diff --git a/test/app.test.js b/test/app.test.js index f673247..6810089 100644 --- a/test/app.test.js +++ b/test/app.test.js @@ -39,6 +39,15 @@ test("homepage", t => { "/post/testfile", "first post url" ); + t.is( + $(".post:first-of-type time").text(), + "Sunday, January 1, 2017", + "first post date" + ); + t.is( + $(".post:first-of-type time").attr("datetime"), + new Date("2017-01-01").toISOString() + ); return $; }) .then(toMicroformatsOptions) @@ -83,6 +92,15 @@ test("post", t => { "This is a test", "article header is post title" ); + t.is( + $("article time").text(), + "Sunday, January 1, 2017", + "first post date" + ); + t.is( + $("article time").attr("datetime"), + new Date("2017-01-01").toISOString() + ); t.is( $("article p").text(), `Ut enim blandit volutpat maecenas? Volutpat blandit aliquam etiam erat \ @@ -124,6 +142,11 @@ test("tags", t => { "/post/testfile", "post url" ); + t.is( + $(".post:first-of-type time").text(), + "Sunday, January 1, 2017", + "first post date" + ); }); }); diff --git a/test/domain/posts.test.js b/test/domain/posts.test.js index c433ce5..cc236c7 100644 --- a/test/domain/posts.test.js +++ b/test/domain/posts.test.js @@ -14,6 +14,7 @@ test("get", t => { Object.entries({ title: "This is a test", description: "Test file", + date: new Date("2017-01-01T00:00:00Z"), tags: ["a", "b"] }) ); diff --git a/test/testsite/posts/testfile.md b/test/testsite/posts/testfile.md index 65f2122..84d8ed1 100644 --- a/test/testsite/posts/testfile.md +++ b/test/testsite/posts/testfile.md @@ -1,6 +1,7 @@ +++ Title = "This is a test" Description = "Test file" +Date = 2017-01-01T02:00:00+02:00 Tags = ["a", "b"] +++ Ut enim blandit volutpat maecenas? Volutpat blandit aliquam etiam erat -- cgit 1.4.1