about summary refs log tree commit diff stats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/app.test.js47
1 files changed, 36 insertions, 11 deletions
diff --git a/test/app.test.js b/test/app.test.js
index d298a03..e0ddb87 100644
--- a/test/app.test.js
+++ b/test/app.test.js
@@ -29,11 +29,15 @@ test("homepage", t => {
     .expect(/^<!DOCTYPE html>/)
     .then(parseResponse)
     .then($ => {
-      t.is($("head > title").text(), "John Doe");
-      t.is($("h1").text(), "John Doe");
-      t.is($("main").length, 1);
-      t.is($("main .posts").length, 1);
-      t.is($(".post:first-of-type a").attr("href"), "/post/testfile");
+      t.is($("head > title").text(), "John Doe", "head title is site author");
+      t.is($("h1").text(), "John Doe", "h1 is site author");
+      t.is($("main").length, 1, "only one <main> tag");
+      t.is($("main .posts").length, 1, "contains one posts listing");
+      t.is(
+        $(".post:first-of-type a").attr("href"),
+        "/post/testfile",
+        "first post url"
+      );
       return $;
     })
     .then(toMicroformatsOptions)
@@ -67,13 +71,22 @@ test("post", t => {
     .expect(/^<!DOCTYPE html>/)
     .then(parseResponse)
     .then($ => {
-      t.is($("head > title").text(), "This is a test · " + "John Doe");
-      t.is($("article h1").text(), "This is a test");
+      t.is(
+        $("head > title").text(),
+        "This is a test · " + "John Doe",
+        "head title contains post and site author"
+      );
+      t.is(
+        $("article h1").text(),
+        "This is a test",
+        "article header is post title"
+      );
       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 \
-urna duis convallis convallis tellus, id interdum velit laoreet!`
+urna duis convallis convallis tellus, id interdum velit laoreet!`,
+        "article has text"
       );
     });
 });
@@ -93,9 +106,21 @@ test("tags", t => {
     .expect(/^<!DOCTYPE html>/)
     .then(parseResponse)
     .then($ => {
-      t.is($("head > title").text(), "A · John Doe");
-      t.is($(".post a").text(), "This is a test");
-      t.is($(".post:first-of-type a").attr("href"), "/post/testfile");
+      t.is(
+        $("head > title").text(),
+        "A · John Doe",
+        "head title contains title-cased tag and site name"
+      );
+      t.is(
+        $(".post a").text(),
+        "This is a test",
+        "post link text is post title"
+      );
+      t.is(
+        $(".post:first-of-type a").attr("href"),
+        "/post/testfile",
+        "post url"
+      );
     });
 });