summary refs log tree commit diff stats
path: root/test
diff options
context:
space:
mode:
authorAlan Pearce2017-07-01 14:11:52 +0200
committerAlan Pearce2017-07-01 14:12:07 +0200
commit2d931962b74fe06c1bfbc2454fa166d24e8e2f59 (patch)
tree028972fae8fe6d7274ad58ccae5ac8bcc1f93d8e /test
parentb0b4517c1329595f9525bcc9e9e176dc5b43f575 (diff)
downloadhomestead-2d931962b74fe06c1bfbc2454fa166d24e8e2f59.tar.lz
homestead-2d931962b74fe06c1bfbc2454fa166d24e8e2f59.tar.zst
homestead-2d931962b74fe06c1bfbc2454fa166d24e8e2f59.zip
feat: Add date to posts
Diffstat (limited to 'test')
-rw-r--r--test/app.test.js23
-rw-r--r--test/domain/posts.test.js1
-rw-r--r--test/testsite/posts/testfile.md1
3 files changed, 25 insertions, 0 deletions
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)
@@ -84,6 +93,15 @@ test("post", t => {
         "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 \
 velit, scelerisque in dictum non, consectetur a erat nam at lectus \
@@ -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